广告平台(站长下代理使用)
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

svc_medium.go 1.8 KiB

2ヶ月前
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. }
  39. medium := NewMediumDb.GetSuperAdmin(v.AgentWithMedium.MediumId)
  40. if medium != nil {
  41. tmp.Account = medium.Username
  42. }
  43. list = append(list, tmp)
  44. }
  45. }
  46. res := md.MediumListRes{
  47. List: list,
  48. Total: total,
  49. State: []md.SelectData{
  50. {Name: "待提交", Value: "0"},
  51. {Name: "待审核", Value: "1"},
  52. {Name: "审核通过", Value: "2"},
  53. {Name: "审核拒绝", Value: "3"},
  54. },
  55. }
  56. e.OutSuc(c, res, nil)
  57. return
  58. }