广告平台(媒体使用)
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 
 

56 wiersze
1.7 KiB

  1. package svc
  2. import (
  3. "applet/app/md"
  4. "applet/app/utils"
  5. db "code.fnuoos.com/zhimeng/model.git/src"
  6. "code.fnuoos.com/zhimeng/model.git/src/super/implement"
  7. "encoding/json"
  8. "github.com/gin-gonic/gin"
  9. )
  10. func InvoiceCenterList(c *gin.Context, req md.InvoiceCenterDataReq) md.InvoiceCenterDataRes {
  11. user := GetUser(c)
  12. engine := db.Db
  13. NewMediumInvoiceDb := implement.NewMediumInvoiceDb(engine)
  14. MediumList, total, _ := NewMediumInvoiceDb.FindMediumInvoiceList(c.GetString("mid"), req.Type, utils.IntToStr(user.MediumId), utils.StrToInt(req.Page), utils.StrToInt(req.Limit))
  15. data := make([]md.InvoiceCenterDataData, 0)
  16. if len(MediumList) > 0 {
  17. for _, v := range MediumList {
  18. var tmp = md.InvoiceCenterDataData{
  19. Id: utils.IntToStr(v.MediumInvoice.Id),
  20. TimeStr: v.MediumInvoice.UpdateAt,
  21. Month: v.StartDate,
  22. Count: utils.IntToStr(v.MediumInvoice.Count),
  23. Amount: utils.Float64ToStr(float64(v.MediumSettlement.OtherIncome+v.MediumSettlement.BasicIncome) / 100),
  24. State: utils.IntToStr(v.MediumInvoice.State),
  25. }
  26. data = append(data, tmp)
  27. }
  28. }
  29. res := md.InvoiceCenterDataRes{
  30. List: data,
  31. Total: total,
  32. State: md.InvoiceState,
  33. }
  34. return res
  35. }
  36. func InvoiceCenterDetail(c *gin.Context, req md.CommDetailReq) md.InvoiceCenterDataDetailRes {
  37. engine := db.Db
  38. NewMediumInvoiceDb := implement.NewMediumInvoiceDb(engine)
  39. data, _ := NewMediumInvoiceDb.GetMediumInvoiceById(utils.StrToInt(req.Id))
  40. file := make([]md.InvoiceFile, 0)
  41. json.Unmarshal([]byte(data.File), &file)
  42. tmp := md.InvoiceCenterDataDetailData{
  43. TimeStr: data.UpdateAt,
  44. State: utils.IntToStr(data.State),
  45. Count: utils.IntToStr(data.Count),
  46. File: file,
  47. }
  48. res := md.InvoiceCenterDataDetailRes{
  49. Data: tmp,
  50. State: md.InvoiceState,
  51. }
  52. return res
  53. }