广告平台(站长下代理使用)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

64 rivejä
1.9 KiB

  1. package svc
  2. import (
  3. "applet/app/e"
  4. "applet/app/lib/validate"
  5. "applet/app/md"
  6. "applet/app/utils"
  7. db "code.fnuoos.com/zhimeng/model.git/src"
  8. implement2 "code.fnuoos.com/zhimeng/model.git/src/implement"
  9. "code.fnuoos.com/zhimeng/model.git/src/super/implement"
  10. "github.com/gin-gonic/gin"
  11. )
  12. func MediumList(c *gin.Context) {
  13. var req md.MediumListReq
  14. err := c.ShouldBindJSON(&req)
  15. if err != nil {
  16. err = validate.HandleValidateErr(err)
  17. err1 := err.(e.E)
  18. e.OutErr(c, err1.Code, err1.Error())
  19. return
  20. }
  21. user := GetUser(c)
  22. engine := db.Db
  23. agentWithMediumDb := implement.NewAgentWithMediumDb(engine)
  24. data, total, _ := agentWithMediumDb.FindAgentWithMediumList(req.Name, req.State, user.AgentId, 0, utils.StrToInt(req.Page), utils.StrToInt(req.Limit))
  25. list := make([]md.MediumListData, 0)
  26. NewMediumDb := implement2.NewMediumDb(MasterDb(c))
  27. if data != nil {
  28. for _, v := range data {
  29. tmp := md.MediumListData{
  30. Id: utils.IntToStr(v.AgentWithMedium.Id),
  31. MediumId: utils.IntToStr(v.AgentWithMedium.MediumId),
  32. CompanyName: v.MediumList.CompanyName,
  33. UnifiedSocialCreditCode: v.MediumList.UnifiedSocialCreditCode,
  34. State: utils.IntToStr(v.MediumList.State),
  35. Memo: v.MediumList.Memo,
  36. LegalRepresentative: v.MediumList.LegalRepresentative,
  37. BusinessLicenseAddress: v.MediumList.BusinessLicenseAddress,
  38. BusinessLicenseImg: v.MediumList.BusinessLicenseImgUrl,
  39. }
  40. medium := NewMediumDb.GetSuperAdmin(v.AgentWithMedium.MediumId)
  41. if medium != nil {
  42. tmp.Account = medium.Username
  43. }
  44. list = append(list, tmp)
  45. }
  46. }
  47. res := md.MediumListRes{
  48. List: list,
  49. Total: total,
  50. State: []md.SelectData{
  51. {Name: "待提交", Value: "0"},
  52. {Name: "待审核", Value: "1"},
  53. {Name: "审核通过", Value: "2"},
  54. {Name: "审核拒绝", Value: "3"},
  55. },
  56. }
  57. e.OutSuc(c, res, nil)
  58. return
  59. }