Sfoglia il codice sorgente

媒体中心

master
huangjiajun 2 mesi fa
parent
commit
7dac4131cf
14 ha cambiato i file con 377 aggiunte e 19 eliminazioni
  1. +2
    -2
      app/enum/enum_qualification.go
  2. +1
    -1
      app/hdl/hdl_agent_qualification.go
  3. +3
    -3
      app/hdl/hdl_applet_application.go
  4. +3
    -3
      app/hdl/hdl_applet_application_ad_space_list.go
  5. +123
    -0
      app/hdl/hdl_medium_agent.go
  6. +1
    -1
      app/hdl/hdl_medium_qualification.go
  7. +3
    -0
      app/md/md_agent_qualification.go
  8. +32
    -0
      app/md/md_medium.go
  9. +3
    -0
      app/md/md_medium_qualification.go
  10. +9
    -1
      app/router/router.go
  11. +21
    -5
      app/svc/svc_agent_qualification.go
  12. +156
    -0
      app/svc/svc_medium_agent.go
  13. +19
    -2
      app/svc/svc_medium_qualification.go
  14. +1
    -1
      go.mod

+ 2
- 2
app/enum/enum_qualification.go Vedi File

@@ -13,11 +13,11 @@ func (gt QualificationState) String() string {
case QualificationStateForNormal:
return "审核成功"
case QualificationStateForFail:
return "审核失败"
return "审核拒绝"
case QualificationStateForWait:
return "待审核"
default:
return "待审核"
return "待提交"
}
}



+ 1
- 1
app/hdl/hdl_agent_qualification.go Vedi File

@@ -28,7 +28,7 @@ func AgentQualificationEnterprise(c *gin.Context) {
e.OutErr(c, err1.Code, err1.Error())
return
}
res := svc.AgentQualificationEnterprise(c, req)
res := svc.AgentQualificationEnterprise(c, 1, req)
e.OutSuc(c, res, nil)
return
}


+ 3
- 3
app/hdl/hdl_applet_application.go Vedi File

@@ -15,7 +15,7 @@ import (
// @Param args body md.AppletApplicationMediumListReq true "请求参数"
// @Success 200 {object} md.AppletApplicationMediumListRes "具体看返回内容---这是data里面的数据"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/medium/applet/application/medium/list [POST]
// @Router /api/mediumCenter/applet/application/medium/list [POST]
func AppletApplicationMediumList(c *gin.Context) {
svc.AppletApplicationMediumList(c)
}
@@ -30,7 +30,7 @@ func AppletApplicationMediumList(c *gin.Context) {
// @Param args body md.AppletApplicationListReq true "请求参数"
// @Success 200 {object} md.AppletApplicationListRes "具体看返回内容---这是data里面的数据"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/medium/applet/application/list [POST]
// @Router /api/mediumCenter/applet/application/list [POST]
func AppletApplicationList(c *gin.Context) {
svc.AppletApplicationList(c)
}
@@ -45,7 +45,7 @@ func AppletApplicationList(c *gin.Context) {
// @Param args body md.AppletApplicationSaveReq true "请求参数"
// @Success 200 {string} "具体看返回内容"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/medium/applet/application/audit [POST]
// @Router /api/mediumCenter/applet/application/audit [POST]
func AppletApplicationAudit(c *gin.Context) {
svc.AppletApplicationAudit(c)
}

+ 3
- 3
app/hdl/hdl_applet_application_ad_space_list.go Vedi File

@@ -15,7 +15,7 @@ import (
// @Param args body md.AppletApplicationAdSpaceMediumListReq true "请求参数"
// @Success 200 {object} md.AppletApplicationAdSpaceMediumListRes "具体看返回内容---这是data里面的数据"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/medium/applet/application/ad/space/list [POST]
// @Router /api/mediumCenter/applet/application/ad/space/list [POST]
func AppletApplicationAdSpaceMediumList(c *gin.Context) {
svc.AppletApplicationAdSpaceMediumList(c)
}
@@ -30,7 +30,7 @@ func AppletApplicationAdSpaceMediumList(c *gin.Context) {
// @Param args body md.AppletApplicationAdSpaceListReq true "请求参数"
// @Success 200 {object} md.AppletApplicationAdSpaceListRes "具体看返回内容---这是data里面的数据"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/medium/applet/application/ad/space/save [POST]
// @Router /api/mediumCenter/applet/application/ad/space/save [POST]
func AppletApplicationAdSpaceList(c *gin.Context) {
svc.AppletApplicationAdSpaceList(c)
}
@@ -45,7 +45,7 @@ func AppletApplicationAdSpaceList(c *gin.Context) {
// @Param args body md.AppletApplicationAdSpaceSaveReq true "请求参数"
// @Success 200 {string} "具体看返回内容"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/medium/applet/application/ad/space/audit [POST]
// @Router /api/mediumCenter/applet/application/ad/space/audit [POST]
func AppletApplicationAdSpaceAudit(c *gin.Context) {
svc.AppletApplicationAdSpaceAudit(c)
}

+ 123
- 0
app/hdl/hdl_medium_agent.go Vedi File

@@ -0,0 +1,123 @@
package hdl

import (
"applet/app/e"
"applet/app/lib/validate"
"applet/app/md"
"applet/app/svc"
"github.com/gin-gonic/gin"
)

// AgentList
// @Summary 代理列表
// @Tags 媒体中心------嘉俊
// @Description 媒体中心-代理列表
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Accept json
// @Produce json
// @Param args body md.AgentQualificationEnterpriseReq true "请求参数"
// @Success 200 {object} md.AgentQualificationEnterpriseRes "具体看返回内容 这是data里面的数据"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/mediumCenter/agent/list [POST]
func AgentList(c *gin.Context) {
var req md.AgentQualificationEnterpriseReq
err := c.ShouldBindJSON(&req)
if err != nil {
err = validate.HandleValidateErr(err)
err1 := err.(e.E)
e.OutErr(c, err1.Code, err1.Error())
return
}
res := svc.AgentQualificationEnterprise(c, 0, req)
e.OutSuc(c, res, nil)
return
}

// AgentBindMediumList
// @Summary 代理绑定媒体列表
// @Tags 媒体中心------嘉俊
// @Description 媒体中心-代理绑定媒体列表
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Accept json
// @Produce json
// @Param args body md.MediumListReq true "请求参数"
// @Success 200 {object} md.MediumListRes "具体看返回内容 这是data里面的数据"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/mediumCenter/agent/bind/medium/list [POST]
func AgentBindMediumList(c *gin.Context) {
svc.AgentBindMediumList(c)
return
}

// MediumList
// @Summary 媒体列表
// @Tags 媒体中心------嘉俊
// @Description 媒体中心-媒体列表
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Accept json
// @Produce json
// @Param args body md.MediumQualificationEnterpriseReq true "请求参数"
// @Success 200 {object} md.MediumQualificationEnterpriseRes "具体看返回内容 这是data里面的数据"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/mediumCenter/medium/list [POST]
func MediumList(c *gin.Context) {
var req md.MediumQualificationEnterpriseReq
err := c.ShouldBindJSON(&req)
if err != nil {
err = validate.HandleValidateErr(err)
err1 := err.(e.E)
e.OutErr(c, err1.Code, err1.Error())
return
}
res := svc.MediumQualificationEnterprise(c, 0, req)
e.OutSuc(c, res, nil)
return
}

// MediumBindAgentList
// @Summary 媒体绑定代理列表
// @Tags 媒体中心------嘉俊
// @Description 媒体中心-媒体绑定代理列表
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Accept json
// @Produce json
// @Param args body md.MediumListReq true "请求参数"
// @Success 200 {object} md.MediumListRes "具体看返回内容 这是data里面的数据"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/mediumCenter/medium/bind/agent/list [POST]
func MediumBindAgentList(c *gin.Context) {
svc.MediumBindAgentList(c)
return
}

// MediumBindAgentSave
// @Summary 媒体绑定代理操作
// @Tags 媒体中心------嘉俊
// @Description 媒体中心-媒体绑定代理操作
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Accept json
// @Produce json
// @Param args body md.MediumListSaveReq true "请求参数"
// @Success 200 {string} "具体看返回内容 "
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/mediumCenter/medium/bind/agent/save [POST]
func MediumBindAgentSave(c *gin.Context) {
svc.MediumBindAgentSave(c)
return
}

// MediumBindAgentDel
// @Summary 媒体绑定代理删除
// @Tags 媒体中心------嘉俊
// @Description 媒体中心-媒体绑定代理删除
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Accept json
// @Produce json
// @Param args body md.MediumListDelReq true "请求参数"
// @Success 200 {string} "具体看返回内容 "
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/mediumCenter/medium/bind/agent/del [POST]
func MediumBindAgentDel(c *gin.Context) {
svc.MediumBindAgentDel(c)
return
}

+ 1
- 1
app/hdl/hdl_medium_qualification.go Vedi File

@@ -28,7 +28,7 @@ func MediumQualificationEnterprise(c *gin.Context) {
e.OutErr(c, err1.Code, err1.Error())
return
}
res := svc.MediumQualificationEnterprise(c, req)
res := svc.MediumQualificationEnterprise(c, 1, req)
e.OutSuc(c, res, nil)
return
}


+ 3
- 0
app/md/md_agent_qualification.go Vedi File

@@ -42,6 +42,7 @@ type AgentQualificationEnterpriseData struct {
BusinessLicenseAddress string `json:"business_license_address" example:"营业执照地址"`
CertificateValidity string `json:"certificate_validity" example:"证件有效期"`
Memo string `json:"memo" example:"备注 审核时填写的"`
Account string `json:"account" example:"账号"`
}
type AgentQualificationBankRes struct {
State []SelectData `json:"state" `
@@ -63,6 +64,7 @@ type AgentQualificationBankData struct {
Memo string `json:"memo" example:"备注 审核时填写的"`
State string `json:"state" example:"状态(0:待提交 1:待审核 2:审核通过 3:审核拒绝)"`
UnifiedSocialCreditCode string `json:"unified_social_credit_code" example:"统一社会信用代码"`
Account string `json:"account" example:"账号"`
}

type AgentQualificationContactRes struct {
@@ -81,4 +83,5 @@ type AgentQualificationContactData struct {
Name string `json:"name" example:"联系人"`
Phone string `json:"phone" example:"联系电话"`
State string `json:"state" example:"状态(0:待提交 1:待审核 2:审核通过 3:审核拒绝)"`
Account string `json:"account" example:"账号"`
}

+ 32
- 0
app/md/md_medium.go Vedi File

@@ -0,0 +1,32 @@
package md

type MediumListReq struct {
Id string `json:"id"`
Limit string `json:"limit"`
Page string `json:"page" `
Name string `json:"name"`
State string `json:"state"`
}
type MediumListRes struct {
State []SelectData `json:"state" `
List []MediumListData `json:"list"`
Total int64 `json:"total"`
}
type MediumListData struct {
MediumId string `json:"medium_id" example:"媒体id"`
CompanyName string `json:"company_name" example:"公司名称"`
Id string `json:"id" example:"id"`
Memo string `json:"memo" example:"备注 审核时填写的"`
State string `json:"state" example:"状态(0:待提交 1:待审核 2:审核通过 3:审核拒绝)"`
UnifiedSocialCreditCode string `json:"unified_social_credit_code" example:"统一社会信用代码"`
LegalRepresentative string `json:"legal_representative" example:"法定代表人"`
Account string `json:"account" example:"媒体账号"`
BusinessLicenseAddress string `json:"business_license_address" example:"营业执照地址"`
}
type MediumListSaveReq struct {
Username string `json:"username"`
MediumId string `json:"medium_id"`
}
type MediumListDelReq struct {
Id string `json:"id" example:"列表id"`
}

+ 3
- 0
app/md/md_medium_qualification.go Vedi File

@@ -42,6 +42,7 @@ type MediumQualificationEnterpriseData struct {
BusinessLicenseAddress string `json:"business_license_address" example:"营业执照地址"`
CertificateValidity string `json:"certificate_validity" example:"证件有效期"`
Memo string `json:"memo" example:"备注 审核时填写的"`
Account string `json:"account" example:"账号"`
}
type MediumQualificationBankRes struct {
State []SelectData `json:"state" `
@@ -63,6 +64,7 @@ type MediumQualificationBankData struct {
Memo string `json:"memo" example:"备注 审核时填写的"`
State string `json:"state" example:"状态(0:待提交 1:待审核 2:审核通过 3:审核拒绝)"`
UnifiedSocialCreditCode string `json:"unified_social_credit_code" example:"统一社会信用代码"`
Account string `json:"account" example:"账号"`
}

type MediumQualificationContactRes struct {
@@ -81,4 +83,5 @@ type MediumQualificationContactData struct {
Name string `json:"name" example:"联系人"`
Phone string `json:"phone" example:"联系电话"`
State string `json:"state" example:"状态(0:待提交 1:待审核 2:审核通过 3:审核拒绝)"`
Account string `json:"account" example:"账号"`
}

+ 9
- 1
app/router/router.go Vedi File

@@ -66,7 +66,7 @@ func route(r *gin.RouterGroup) {
rAgentQualification(r.Group("/agentQualification")) //渠道-资质
rMediumQualification(r.Group("/mediumQualification")) //媒体-资质
rSetCenter(r.Group("/setCenter")) //设置中心
rMedium(r.Group("/medium")) //媒体中心
rMedium(r.Group("/mediumCenter")) //媒体中心
}

func rRole(r *gin.RouterGroup) {
@@ -134,4 +134,12 @@ func rMedium(r *gin.RouterGroup) {
r.POST("/applet/application/ad/space/medium/list", hdl.AppletApplicationAdSpaceMediumList) //广告管理-媒体列表
r.POST("/applet/application/ad/space/list", hdl.AppletApplicationAdSpaceList) //小程序应用-广告位列表数据
r.POST("/applet/application/ad/space/audit", hdl.AppletApplicationAdSpaceAudit) //小程序应用-广告位审核

r.POST("/medium/list", hdl.MediumList) //媒体列表
r.POST("/medium/bind/agent/list", hdl.MediumBindAgentList) //媒体绑定代理列表
r.POST("/medium/bind/agent/save", hdl.MediumBindAgentSave) //媒体绑定代理操作
r.POST("/medium/bind/agent/del", hdl.MediumBindAgentDel) //媒体绑定代理删除

r.POST("/agent/list", hdl.AgentList) //代理列表
r.POST("/agent/bind/medium/list", hdl.AgentBindMediumList) //代理绑定媒体列表
}

+ 21
- 5
app/svc/svc_agent_qualification.go Vedi File

@@ -6,18 +6,20 @@ import (
"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"
"github.com/jinzhu/copier"
)

func AgentQualificationEnterprise(c *gin.Context, req md.AgentQualificationEnterpriseReq) md.AgentQualificationEnterpriseRes {
func AgentQualificationEnterprise(c *gin.Context, minState int, req md.AgentQualificationEnterpriseReq) md.AgentQualificationEnterpriseRes {

engine := db.Db
agentListDb := implement.NewAgentListDb(engine)
agentList, total, _ := agentListDb.FindAgentList(req.Name, req.State, utils.StrToInt(req.Page), utils.StrToInt(req.Limit))
agentList, total, _ := agentListDb.FindAgentList(c.GetString("mid"), req.Name, req.State, minState, utils.StrToInt(req.Page), utils.StrToInt(req.Limit))
data := make([]md.AgentQualificationEnterpriseData, 0)
if len(agentList) > 0 {
NewAgentDb := implement2.NewAgentDb(MasterDb(c))
for _, v := range agentList {
var tmp md.AgentQualificationEnterpriseData
copier.Copy(&tmp, &v)
@@ -33,6 +35,10 @@ func AgentQualificationEnterprise(c *gin.Context, req md.AgentQualificationEnter
tmp.RegisteredAddressCityId = utils.IntToStr(v.RegisteredAddressCityId)
tmp.RegisteredAddressCountyId = utils.IntToStr(v.RegisteredAddressCountyId)
tmp.State = utils.IntToStr(v.State)
agent := NewAgentDb.GetSuperAdmin(v.AgentId)
if agent != nil {
tmp.Account = agent.Username
}
data = append(data, tmp)
}
}
@@ -86,10 +92,10 @@ func AgentQualificationEnterpriseAudit(c *gin.Context, req md.AgentQualification
func AgentQualificationBank(c *gin.Context, req md.AgentQualificationEnterpriseReq) md.AgentQualificationBankRes {
engine := db.Db
agentListDb := implement.NewAgentBankInfoDb(engine)
agentList, total, _ := agentListDb.FindAgentBankInfoList(req.Name, req.State, utils.StrToInt(req.Page), utils.StrToInt(req.Limit))

agentList, total, _ := agentListDb.FindAgentBankInfoList(c.GetString("mid"), req.Name, req.State, utils.StrToInt(req.Page), utils.StrToInt(req.Limit))
list := make([]md.AgentQualificationBankData, 0)
if agentList != nil {
NewAgentDb := implement2.NewAgentDb(MasterDb(c))
for _, v := range agentList {
tmp := md.AgentQualificationBankData{
Id: utils.IntToStr(v.AgentBankInfo.Id),
@@ -105,6 +111,10 @@ func AgentQualificationBank(c *gin.Context, req md.AgentQualificationEnterpriseR
BankNo: v.BankNo,
Licence: v.Licence,
}
agent := NewAgentDb.GetSuperAdmin(v.AgentBankInfo.AgentId)
if agent != nil {
tmp.Account = agent.Username
}
list = append(list, tmp)
}
}
@@ -162,10 +172,11 @@ func AgentQualificationBankAudit(c *gin.Context, req md.AgentQualificationEnterp
func AgentQualificationContactInfo(c *gin.Context, req md.AgentQualificationEnterpriseReq) md.AgentQualificationContactRes {
engine := db.Db
agentListDb := implement.NewAgentContactInfoDb(engine)
agentList, total, _ := agentListDb.FindAgentContactInfoList(req.Name, req.State, utils.StrToInt(req.Page), utils.StrToInt(req.Limit))
agentList, total, _ := agentListDb.FindAgentContactInfoList(c.GetString("mid"), req.Name, req.State, utils.StrToInt(req.Page), utils.StrToInt(req.Limit))

list := make([]md.AgentQualificationContactData, 0)
if agentList != nil {
NewAgentDb := implement2.NewAgentDb(MasterDb(c))
for _, v := range agentList {
tmp := md.AgentQualificationContactData{
Id: utils.IntToStr(v.AgentContactInfo.Id),
@@ -179,6 +190,11 @@ func AgentQualificationContactInfo(c *gin.Context, req md.AgentQualificationEnte
Phone: v.AgentContactInfo.Phone,
Address: v.AgentContactInfo.Address,
}

agent := NewAgentDb.GetSuperAdmin(v.AgentContactInfo.AgentId)
if agent != nil {
tmp.Account = agent.Username
}
list = append(list, tmp)
}
}


+ 156
- 0
app/svc/svc_medium_agent.go Vedi File

@@ -0,0 +1,156 @@
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"
"code.fnuoos.com/zhimeng/model.git/src/super/model"
"github.com/gin-gonic/gin"
"strings"
"time"
)

func AgentBindMediumList(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
}
engine := db.Db
agentWithMediumDb := implement.NewAgentWithMediumDb(engine)
data, total, _ := agentWithMediumDb.FindAgentWithMediumList(req.Name, req.State, utils.StrToInt(req.Id), 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
}
func MediumBindAgentList(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
}
engine := db.Db
agentWithMediumDb := implement.NewAgentWithMediumDb(engine)
data, total, _ := agentWithMediumDb.FindAgentWithMediumList(req.Name, req.State, 0, utils.StrToInt(req.Id), utils.StrToInt(req.Page), utils.StrToInt(req.Limit))

list := make([]md.MediumListData, 0)
NewAgentDb := implement2.NewAgentDb(MasterDb(c))

if data != nil {
for _, v := range data {
tmp := md.MediumListData{
Id: utils.IntToStr(v.AgentWithMedium.Id),
MediumId: utils.IntToStr(v.AgentWithMedium.AgentId),
CompanyName: v.AgentList.CompanyName,
UnifiedSocialCreditCode: v.AgentList.UnifiedSocialCreditCode,
State: utils.IntToStr(v.AgentList.State),
Memo: v.AgentList.Memo,
LegalRepresentative: v.AgentList.LegalRepresentative,
BusinessLicenseAddress: v.AgentList.BusinessLicenseAddress,
}
agent := NewAgentDb.GetSuperAdmin(v.AgentWithMedium.AgentId)
if agent != nil {
tmp.Account = agent.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
}
func MediumBindAgentSave(c *gin.Context) {
var req md.MediumListSaveReq
err := c.ShouldBindJSON(&req)
if err != nil {
err = validate.HandleValidateErr(err)
err1 := err.(e.E)
e.OutErr(c, err1.Code, err1.Error())
return
}
agentDb := implement2.NewAgentDb(MasterDb(c))
username, _ := agentDb.GetSuperAgentByUsername(req.Username)
if username == nil {
e.OutErr(c, 400, e.NewErr(400, "渠道代理不存在"))
return
}
mediumDb := implement.NewAgentWithMediumDb(db.Db)
data := mediumDb.GetAgentWithMediumByMediumIdAndAgentId(utils.StrToInt(req.MediumId), username.AgentId)
if data != nil {
e.OutErr(c, 400, e.NewErr(400, "已绑定过该渠道代理"))
return
}
var tmp = model.AgentWithMedium{
AgentId: username.AgentId,
MediumId: utils.StrToInt(req.MediumId),
CreateAt: time.Now(),
UpdateAt: time.Now(),
}
db.Db.InsertOne(&tmp)
e.OutSuc(c, "success", nil)
return
}
func MediumBindAgentDel(c *gin.Context) {
var req md.MediumListDelReq
err := c.ShouldBindJSON(&req)
if err != nil {
err = validate.HandleValidateErr(err)
err1 := err.(e.E)
e.OutErr(c, err1.Code, err1.Error())
return
}
db.Db.In("id", strings.Split(req.Id, ",")).Delete(&model.AgentWithMedium{})
e.OutSuc(c, "success", nil)
return
}

+ 19
- 2
app/svc/svc_medium_qualification.go Vedi File

@@ -6,18 +6,20 @@ import (
"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"
"github.com/jinzhu/copier"
)

func MediumQualificationEnterprise(c *gin.Context, req md.MediumQualificationEnterpriseReq) md.MediumQualificationEnterpriseRes {
func MediumQualificationEnterprise(c *gin.Context, minState int, req md.MediumQualificationEnterpriseReq) md.MediumQualificationEnterpriseRes {

engine := db.Db
MediumListDb := implement.NewMediumListDb(engine)
MediumList, total, _ := MediumListDb.FindMediumList(c.GetString("mid"), req.Name, req.State, utils.StrToInt(req.Page), utils.StrToInt(req.Limit))
MediumList, total, _ := MediumListDb.FindMediumList(c.GetString("mid"), req.Name, req.State, minState, utils.StrToInt(req.Page), utils.StrToInt(req.Limit))
data := make([]md.MediumQualificationEnterpriseData, 0)
if len(MediumList) > 0 {
NewMediumDb := implement2.NewMediumDb(MasterDb(c))
for _, v := range MediumList {
var tmp md.MediumQualificationEnterpriseData
copier.Copy(&tmp, &v)
@@ -33,6 +35,10 @@ func MediumQualificationEnterprise(c *gin.Context, req md.MediumQualificationEnt
tmp.RegisteredAddressCityId = utils.IntToStr(v.RegisteredAddressCityId)
tmp.RegisteredAddressCountyId = utils.IntToStr(v.RegisteredAddressCountyId)
tmp.State = utils.IntToStr(v.State)
medium := NewMediumDb.GetSuperAdmin(v.MediumId)
if medium != nil {
tmp.Account = medium.Username
}
data = append(data, tmp)
}
}
@@ -90,6 +96,7 @@ func MediumQualificationBank(c *gin.Context, req md.MediumQualificationEnterpris

list := make([]md.MediumQualificationBankData, 0)
if MediumList != nil {
NewMediumDb := implement2.NewMediumDb(MasterDb(c))
for _, v := range MediumList {
tmp := md.MediumQualificationBankData{
Id: utils.IntToStr(v.MediumBankInfo.Id),
@@ -105,6 +112,11 @@ func MediumQualificationBank(c *gin.Context, req md.MediumQualificationEnterpris
BankNo: v.BankNo,
Licence: v.Licence,
}

medium := NewMediumDb.GetSuperAdmin(v.MediumBankInfo.MediumId)
if medium != nil {
tmp.Account = medium.Username
}
list = append(list, tmp)
}
}
@@ -167,6 +179,7 @@ func MediumQualificationContactInfo(c *gin.Context, req md.MediumQualificationEn

list := make([]md.MediumQualificationContactData, 0)
if MediumList != nil {
NewMediumDb := implement2.NewMediumDb(MasterDb(c))
for _, v := range MediumList {
tmp := md.MediumQualificationContactData{
Id: utils.IntToStr(v.MediumContactInfo.Id),
@@ -180,6 +193,10 @@ func MediumQualificationContactInfo(c *gin.Context, req md.MediumQualificationEn
Phone: v.MediumContactInfo.Phone,
Address: v.MediumContactInfo.Address,
}
medium := NewMediumDb.GetSuperAdmin(v.MediumContactInfo.MediumId)
if medium != nil {
tmp.Account = medium.Username
}
list = append(list, tmp)
}
}


+ 1
- 1
go.mod Vedi File

@@ -5,7 +5,7 @@ go 1.18
//replace code.fnuoos.com/zhimeng/model.git => E:/company/ad/models

require (
code.fnuoos.com/zhimeng/model.git v0.0.3-0.20240822095043-f18aa08f09b1
code.fnuoos.com/zhimeng/model.git v0.0.3-0.20240823034048-34202e969e8d
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5
github.com/boombuler/barcode v1.0.1
github.com/dchest/uniuri v0.0.0-20200228104902-7aecb25e1fe5


Caricamento…
Annulla
Salva