|
- package svc
-
- import (
- "applet/app/e"
- "applet/app/lib/validate"
- "applet/app/md"
- "applet/app/utils"
- db "code.fnuoos.com/zhimeng/model.git/src"
- implement2 "code.fnuoos.com/zhimeng/model.git/src/implement"
- "code.fnuoos.com/zhimeng/model.git/src/super/implement"
- "github.com/gin-gonic/gin"
- )
-
- func MediumList(c *gin.Context) {
- var req md.MediumListReq
- err := c.ShouldBindJSON(&req)
- if err != nil {
- err = validate.HandleValidateErr(err)
- err1 := err.(e.E)
- e.OutErr(c, err1.Code, err1.Error())
- return
- }
- user := GetUser(c)
- engine := db.Db
- agentWithMediumDb := implement.NewAgentWithMediumDb(engine)
- data, total, _ := agentWithMediumDb.FindAgentWithMediumList(req.Name, req.State, user.AgentId, 0, utils.StrToInt(req.Page), utils.StrToInt(req.Limit))
-
- list := make([]md.MediumListData, 0)
- NewMediumDb := implement2.NewMediumDb(MasterDb(c))
-
- if data != nil {
- for _, v := range data {
- tmp := md.MediumListData{
- Id: utils.IntToStr(v.AgentWithMedium.Id),
- MediumId: utils.IntToStr(v.AgentWithMedium.MediumId),
- CompanyName: v.MediumList.CompanyName,
- UnifiedSocialCreditCode: v.MediumList.UnifiedSocialCreditCode,
- State: utils.IntToStr(v.MediumList.State),
- Memo: v.MediumList.Memo,
- LegalRepresentative: v.MediumList.LegalRepresentative,
- BusinessLicenseAddress: v.MediumList.BusinessLicenseAddress,
- }
- medium := NewMediumDb.GetSuperAdmin(v.AgentWithMedium.MediumId)
- if medium != nil {
- tmp.Account = medium.Username
- }
- list = append(list, tmp)
- }
- }
- res := md.MediumListRes{
- List: list,
- Total: total,
- State: []md.SelectData{
- {Name: "待提交", Value: "0"},
- {Name: "待审核", Value: "1"},
- {Name: "审核通过", Value: "2"},
- {Name: "审核拒绝", Value: "3"},
- },
- }
- e.OutSuc(c, res, nil)
- return
- }
|