dengbiao 1 месяц назад
Родитель
Сommit
ed7e6897bd
5 измененных файлов: 118 добавлений и 8 удалений
  1. +14
    -0
      app/hdl/hdl_login.go
  2. +77
    -3
      app/hdl/hdl_set_center.go
  3. +15
    -2
      app/md/md_set_center.go
  4. +4
    -0
      app/router/router.go
  5. +8
    -3
      app/svc/svc_medium_agent.go

+ 14
- 0
app/hdl/hdl_login.go Просмотреть файл

@@ -1,6 +1,7 @@
package hdl

import (
implement2 "applet/app/db/implement"
"applet/app/e"
"applet/app/lib/validate"
"applet/app/md"
@@ -12,6 +13,19 @@ import (
"github.com/gin-gonic/gin"
)

func LoginBase(c *gin.Context) {
masterId := svc.GetMasterId(c)
engine := db.DBs[masterId]
sysCfgDb := implement2.NewSysCfgDb(engine, masterId)
res := sysCfgDb.SysCfgFindWithDb("seo_platform_logo", "seo_platform_title")
re := map[string]string{
"seo_logo": res["seo_platform_logo"],
"seo_title": res["seo_platform_title"],
}
e.OutSuc(c, re, nil)
return
}

// Login 登陆
// @Summary 登陆
// @Tags 登录


+ 77
- 3
app/hdl/hdl_set_center.go Просмотреть файл

@@ -565,8 +565,12 @@ func SetLogo(c *gin.Context) {
sysCfgDb := implement2.NewSysCfgDb(engine, masterId)
sysCfgDb.SysCfgUpdate("medium_logo", req.MediumLogo)
sysCfgDb.SysCfgUpdate("agent_logo", req.AgentLogo)
sysCfgDb.SysCfgUpdate("medium_login_logo", req.MediumLoginLogo)
sysCfgDb.SysCfgUpdate("agent_login_logo", req.AgentLoginLogo)
svc.ClearRedis(c, masterId, "medium_logo")
svc.ClearRedis(c, masterId, "agent_logo")
svc.ClearRedis(c, masterId, "medium_login_logo")
svc.ClearRedis(c, masterId, "agent_login_logo")
svc.ClearAllRedis(c, masterId)
e.OutSuc(c, "success", nil)
return
@@ -586,12 +590,82 @@ func GetLogo(c *gin.Context) {
masterId := svc.GetMasterId(c)
engine := db.DBs[masterId]
sysCfgDb := implement2.NewSysCfgDb(engine, masterId)
res := sysCfgDb.SysCfgFindWithDb("medium_logo", "agent_logo")
res := sysCfgDb.SysCfgFindWithDb("medium_logo", "agent_logo", "medium_login_logo", "agent_login_logo")

e.OutSuc(c, md.SetLogoResp{
Data: md.SetLogoReq{
MediumLogo: res["medium_logo"],
AgentLogo: res["agent_logo"],
MediumLogo: res["medium_logo"],
AgentLogo: res["agent_logo"],
MediumLoginLogo: res["medium_login_logo"],
AgentLoginLogo: res["agent_login_logo"],
},
}, nil)
return
}

// SetSeo
// @Summary Seo设置
// @Tags 设置中心-基础设置
// @Description 基础设置-logo设置
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Accept json
// @Produce json
// @Param args body md.SetSeoReq true "请求参数"
// @Success 200 {string} "success"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/setCenter/basic/setSeo [POST]
func SetSeo(c *gin.Context) {
var req md.SetSeoReq
err := c.ShouldBindJSON(&req)
if err != nil {
err = validate.HandleValidateErr(err)
err1 := err.(e.E)
e.OutErr(c, err1.Code, err1.Error())
return
}
masterId := svc.GetMasterId(c)
engine := db.DBs[masterId]
sysCfgDb := implement2.NewSysCfgDb(engine, masterId)
sysCfgDb.SysCfgUpdate("seo_medium_title", req.SeoMediumTitle)
sysCfgDb.SysCfgUpdate("seo_agent_title", req.SeoAgentTitle)
sysCfgDb.SysCfgUpdate("seo_platform_title", req.SeoPlatformTitle)
svc.ClearRedis(c, masterId, "seo_medium_title")
svc.ClearRedis(c, masterId, "seo_agent_title")
svc.ClearRedis(c, masterId, "seo_platform_title")
sysCfgDb.SysCfgUpdate("seo_medium_logo", req.SeoMediumLogo)
sysCfgDb.SysCfgUpdate("seo_agent_logo", req.SeoAgentLogo)
sysCfgDb.SysCfgUpdate("seo_platform_logo", req.SeoPlatformLogo)
svc.ClearRedis(c, masterId, "seo_medium_logo")
svc.ClearRedis(c, masterId, "seo_agent_logo")
svc.ClearRedis(c, masterId, "seo_platform_logo")
svc.ClearAllRedis(c, masterId)
e.OutSuc(c, "success", nil)
return
}

// GetSeo
// @Summary Seo获取
// @Tags 设置中心-基础设置
// @Description 基础设置-logo获取
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Accept json
// @Produce json
// @Success 200 {object} md.SetSeoResp
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/setCenter/basic/getSeo [GET]
func GetSeo(c *gin.Context) {
masterId := svc.GetMasterId(c)
engine := db.DBs[masterId]
sysCfgDb := implement2.NewSysCfgDb(engine, masterId)
res := sysCfgDb.SysCfgFindWithDb("seo_medium_logo", "seo_agent_logo", "seo_platform_logo", "seo_medium_title", "seo_agent_title", "seo_platform_title")
e.OutSuc(c, md.SetSeoResp{
Data: md.SetSeoReq{
SeoMediumTitle: res["seo_medium_title"],
SeoAgentTitle: res["seo_agent_title"],
SeoPlatformTitle: res["seo_platform_title"],
SeoMediumLogo: res["seo_medium_logo"],
SeoAgentLogo: res["seo_agent_logo"],
SeoPlatformLogo: res["seo_platform_logo"],
},
}, nil)
return


+ 15
- 2
app/md/md_set_center.go Просмотреть файл

@@ -56,8 +56,10 @@ type SetMobResp struct {
Data SetMobReq `json:"data"` // 数据内容
}
type SetLogoReq struct {
MediumLogo string `json:"medium_logo"`
AgentLogo string `json:"agent_logo"`
MediumLogo string `json:"medium_logo"`
AgentLogo string `json:"agent_logo"`
MediumLoginLogo string `json:"medium_login_logo"`
AgentLoginLogo string `json:"agent_login_logo"`
}
type SetLogoResp struct {
Data SetLogoReq `json:"data"` // 数据内容
@@ -96,3 +98,14 @@ type AppletSetAmsCategoryBlackListReq struct {
Appid string `json:"appid" binding:"required" example:"授权小程序appid"`
CheckedAmsCategory []string `json:"checked_ams_category"` // 选中的行业列表
}
type SetSeoReq struct {
SeoPlatformTitle string `json:"seo_platform_title"`
SeoAgentTitle string `json:"seo_agent_title"`
SeoMediumTitle string `json:"seo_medium_title"`
SeoPlatformLogo string `json:"seo_platform_logo"`
SeoAgentLogo string `json:"seo_agent_logo"`
SeoMediumLogo string `json:"seo_medium_logo"`
}
type SetSeoResp struct {
Data SetSeoReq `json:"data"` //数据内容
}

+ 4
- 0
app/router/router.go Просмотреть файл

@@ -58,6 +58,7 @@ func route(r *gin.RouterGroup) {
r.Use(mw.DB) // 以下接口需要用到数据库
{
r.POST("/login", hdl.Login)
r.GET("/base", hdl.LoginBase)
}
r.Use(mw.CheckBody) // body参数转换
r.Use(mw.CheckSign) // 签名校验
@@ -132,6 +133,9 @@ func rSetCenter(r *gin.RouterGroup) {
rBasicSetCenter.GET("/getMob", hdl.GetMob)
rBasicSetCenter.POST("/setLogo", hdl.SetLogo)
rBasicSetCenter.GET("/getLogo", hdl.GetLogo)

rBasicSetCenter.POST("/setSeo", hdl.SetSeo)
rBasicSetCenter.GET("/getSeo", hdl.GetSeo)
}
rAppletSetCenter := r.Group("/applet")
{


+ 8
- 3
app/svc/svc_medium_agent.go Просмотреть файл

@@ -24,9 +24,11 @@ func AgentBindMediumList(c *gin.Context) { //代理 查旗下 媒体
e.OutErr(c, err1.Code, err1.Error())
return
}
var tmp model.AgentList
MasterDb(c).Where("id=?", req.Id).Get(&tmp)
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))
data, total, _ := agentWithMediumDb.FindAgentWithMediumList(req.Name, req.State, tmp.AgentId, 0, utils.StrToInt(req.Page), utils.StrToInt(req.Limit))

list := make([]md.MediumListData, 0)
NewMediumDb := implement2.NewMediumDb(MasterDb(c))
@@ -72,9 +74,11 @@ func MediumBindAgentList(c *gin.Context) {
e.OutErr(c, err1.Code, err1.Error())
return
}
var tmp model.MediumList
MasterDb(c).Where("id=?", req.Id).Get(&tmp)
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))
data, total, _ := agentWithMediumDb.FindAgentWithMediumList(req.Name, req.State, 0, tmp.MediumId, utils.StrToInt(req.Page), utils.StrToInt(req.Limit))

list := make([]md.MediumListData, 0)
NewAgentDb := implement2.NewAgentDb(MasterDb(c))
@@ -121,7 +125,8 @@ func MediumBindAgentSave(c *gin.Context) {
return
}
agentDb := implement2.NewAgentDb(MasterDb(c))
username, _ := agentDb.GetSuperAgentByUsername(req.Username)
req.Username = strings.ReplaceAll(req.Username, " ", "")
username, _ := agentDb.GetAgent(utils.StrToInt(req.Username))
if username == nil {
e.OutErr(c, 400, e.NewErr(400, "渠道代理不存在"))
return


Загрузка…
Отмена
Сохранить