Ver a proveniência

更新

master
huangjiajun há 1 mês
ascendente
cometimento
ae568e7a36
5 ficheiros alterados com 75 adições e 21 eliminações
  1. +16
    -16
      app/hdl/hdl_role.go
  2. +9
    -3
      app/svc/svc_agent_qualification.go
  3. +47
    -0
      app/svc/svc_medium_agent.go
  4. +2
    -1
      app/svc/svc_settle_center_agent.go
  5. +1
    -1
      go.mod

+ 16
- 16
app/hdl/hdl_role.go Ver ficheiro

@@ -755,27 +755,27 @@ func RoleAgentList(c *gin.Context) {
return
}
engine := svc.MasterDb(c)
NewMediumDb := implement.NewMediumDb(engine)
appId := svc.GetMediumIdStr(c, 0, req.Name, req.Account)
list, total, _ := NewMediumDb.FindSuperAdminByMediumId(appId, utils.StrToInt(req.Page), utils.StrToInt(req.Limit))
NewAgentDb := implement.NewAgentDb(engine)
appId := svc.GetAgentIdStr(c, 0, req.Name, req.Account)
list, total, _ := NewAgentDb.FindSuperAdminByAgentId(appId, utils.StrToInt(req.Page), utils.StrToInt(req.Limit))
data := make([]md.AdminBindMediumListData, 0)
if len(list) > 0 {
for _, v := range list {
var tmp = md.AdminBindMediumListData{
MediumId: utils.IntToStr(v.MediumId),
MediumId: utils.IntToStr(v.AgentId),
Name: v.Memo,
IsBind: "0",
Account: v.Username,
}
NewMediumListDb := implement2.NewMediumListDb(db.Db)
GetMediumList, _ := NewMediumListDb.GetMediumList(v.MediumId)
if GetMediumList != nil {
tmp.Name = GetMediumList.CompanyName
if GetMediumList.CompanyAbbreviation != "" {
tmp.Name = GetMediumList.CompanyAbbreviation
NewAgentListDb := implement2.NewAgentListDb(db.Db)
GetAgentList, _ := NewAgentListDb.GetAgentList(v.AgentId)
if GetAgentList != nil {
tmp.Name = GetAgentList.CompanyName
if GetAgentList.CompanyAbbreviation != "" {
tmp.Name = GetAgentList.CompanyAbbreviation
}
}
count, _ := engine.Where("medium_id=? and admin_id=?", v.MediumId, req.AdminId).Count(&model.AdminBindMedium{})
count, _ := engine.Where("agent_id=? and admin_id=?", v.AgentId, req.AdminId).Count(&model.AdminBindAgent{})
if count > 0 {
tmp.IsBind = "1"
}
@@ -798,15 +798,15 @@ func RoleBindAgent(c *gin.Context) {
e.OutErr(c, err1.Code, err1.Error())
return
}
NewAdminBindMediumDb := implement.NewAdminBindMediumDb(svc.MasterDb(c))
data := NewAdminBindMediumDb.GetAdminByMediumId(utils.StrToInt(req.AdminId), utils.StrToInt(req.MediumId))
NewAdminBindAgentDb := implement.NewAdminBindAgentDb(svc.MasterDb(c))
data := NewAdminBindAgentDb.GetAdminByAgentId(utils.StrToInt(req.AdminId), utils.StrToInt(req.MediumId))
if data != nil {
e.OutErr(c, 400, e.NewErr(400, "已绑定该媒体"))
return
}
tmp := model.AdminBindMedium{
tmp := model.AdminBindAgent{
AdminId: utils.StrToInt(req.AdminId),
MediumId: utils.StrToInt(req.MediumId),
AgentId: utils.StrToInt(req.MediumId),
CreateAt: time.Now(),
UpdateAt: time.Now(),
}
@@ -823,7 +823,7 @@ func RoleDelAgent(c *gin.Context) {
e.OutErr(c, err1.Code, err1.Error())
return
}
svc.MasterDb(c).Where("medium_id=? and admin_id=?", req.MediumId, req.AdminId).Delete(&model.AdminBindMedium{})
svc.MasterDb(c).Where("agent_id=? and admin_id=?", req.MediumId, req.AdminId).Delete(&model.AdminBindAgent{})
e.OutSuc(c, "success", nil)
return
}

+ 9
- 3
app/svc/svc_agent_qualification.go Ver ficheiro

@@ -36,7 +36,9 @@ func AgentQualificationEnterprise(c *gin.Context, minState int, req md.AgentQual

engine := db.Db
agentListDb := implement.NewAgentListDb(engine)
agentList, total, _ := agentListDb.FindAgentList(c.GetString("mid"), req.Name, req.State, minState, utils.StrToInt(req.Page), utils.StrToInt(req.Limit))
user := GetUser(c)
appIds := GetAgentIdStr(c, user.AdmId, req.Name, "")
agentList, total, _ := agentListDb.FindAgentList(c.GetString("mid"), "", appIds, 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))
@@ -112,7 +114,9 @@ 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(c.GetString("mid"), req.Name, req.State, utils.StrToInt(req.Page), utils.StrToInt(req.Limit))
user := GetUser(c)
appIds := GetAgentIdStr(c, user.AdmId, req.Name, "")
agentList, total, _ := agentListDb.FindAgentBankInfoList(c.GetString("mid"), "", appIds, req.State, utils.StrToInt(req.Page), utils.StrToInt(req.Limit))
list := make([]md.AgentQualificationBankData, 0)
if agentList != nil {
NewAgentDb := implement2.NewAgentDb(MasterDb(c))
@@ -192,7 +196,9 @@ 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(c.GetString("mid"), req.Name, req.State, utils.StrToInt(req.Page), utils.StrToInt(req.Limit))
user := GetUser(c)
appIds := GetAgentIdStr(c, user.AdmId, req.Name, "")
agentList, total, _ := agentListDb.FindAgentContactInfoList(c.GetString("mid"), "", appIds, req.State, utils.StrToInt(req.Page), utils.StrToInt(req.Limit))

list := make([]md.AgentQualificationContactData, 0)
if agentList != nil {


+ 47
- 0
app/svc/svc_medium_agent.go Ver ficheiro

@@ -347,3 +347,50 @@ func GetMediumIdStr(c *gin.Context, admId int, name, account string) string {
}
return str
}
func GetAgentIdStr(c *gin.Context, admId int, name, account string) string {
appId := GetAgentByAccountId(c, name, account)
appIds := []string{"-1"}
NewAdminBindAgentDb := implement2.NewAdminBindAgentDb(MasterDb(c))
list := NewAdminBindAgentDb.FindAll(admId)
ids := make([]string, 0)
for _, v := range list {
appIds = append(appIds, utils.IntToStr(v.AgentId))
ids = append(ids, utils.IntToStr(v.AgentId))
}
NewAdminDb := implement2.NewAdminDb(MasterDb(c))
super, _ := NewAdminDb.GetSuperAdmin()
if len(list) == 0 {
user := GetUser(c)
NewAppletApplicationDb := implement2.NewAgentDb(MasterDb(c))
appList := NewAppletApplicationDb.FindAllSuperAdmin()
if appList != nil {
for _, v := range *appList {
if user.IsSuperAdministrator != 1 && user.ShowTime != "" {
showTime := utils.TimeStdParseUnix(user.ShowTime + " 00:00:00")
if utils.TimeStdParseUnix(v.CreateAt) >= showTime {
appIds = append(appIds, utils.IntToStr(v.AgentId))
ids = append(ids, utils.IntToStr(v.AgentId))
}
}
}
}

}
if admId == 0 || admId == super.AdmId { //为空就查全部
appIds = []string{}
}
if appId != "" { //不为空就判断 有没有在列表里面
appIds = []string{"-1"}
ex := strings.Split(appId, ",")
for _, v := range ex {
if utils.InArr(v, ids) || admId == super.AdmId {
appIds = append(appIds, v)
}
}
}
str := ""
if len(appIds) > 0 {
str = strings.Join(appIds, ",")
}
return str
}

+ 2
- 1
app/svc/svc_settle_center_agent.go Ver ficheiro

@@ -12,7 +12,8 @@ import (
func SettleCenterAgentList(c *gin.Context, req md.SettleCenterDataReq) md.SettleCenterDataRes {
engine := db.Db
NewOriginalWxAdDataDb := implement.NewAgentListDb(engine)
appId := GetAgentByAccountId(c, req.Name, req.Account)
user := GetUser(c)
appId := GetAgentIdStr(c, user.AdmId, req.Name, req.Account)
AgentList, total, _ := NewOriginalWxAdDataDb.FindAgentListBySettleType(c.GetString("mid"), appId, req.State, utils.StrToInt(req.Page), utils.StrToInt(req.Limit))
data := make([]md.SettleCenterDataData, 0)
if len(AgentList) > 0 {


+ 1
- 1
go.mod Ver ficheiro

@@ -35,7 +35,7 @@ require (
require (
code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5
code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git v1.1.21-0.20240830072333-a1980ffb256e
code.fnuoos.com/zhimeng/model.git v0.0.3-0.20241104060107-b89d15ebb7fd
code.fnuoos.com/zhimeng/model.git v0.0.3-0.20241104063459-8c4c9709d02b
github.com/360EntSecGroup-Skylar/excelize v1.4.1
github.com/gin-contrib/cors v1.7.2
github.com/jinzhu/copier v0.4.0


Carregando…
Cancelar
Guardar