Browse Source

更新

master
huangjiajun 3 months ago
parent
commit
dff22d8265
4 changed files with 93 additions and 0 deletions
  1. +10
    -0
      app/hdl/hdl_login.go
  2. +68
    -0
      app/hdl/hdl_set_center.go
  3. +11
    -0
      app/md/md_set_center.go
  4. +4
    -0
      app/router/router.go

+ 10
- 0
app/hdl/hdl_login.go View File

@@ -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,15 @@ 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")
e.OutSuc(c, res, nil)
return
}

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


+ 68
- 0
app/hdl/hdl_set_center.go View File

@@ -593,3 +593,71 @@ func GetLogo(c *gin.Context) {
}, 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
}

+ 11
- 0
app/md/md_set_center.go View File

@@ -62,3 +62,14 @@ type SetLogoReq struct {
type SetLogoResp struct {
Data SetLogoReq `json:"data"` //数据内容
}
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 View File

@@ -56,6 +56,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) //签名校验
@@ -130,6 +131,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")
{


Loading…
Cancel
Save