|
- package hdl
-
- import (
- implement2 "applet/app/db/implement"
- "applet/app/e"
- "applet/app/enum"
- "applet/app/lib/validate"
- "applet/app/md"
- "applet/app/svc"
- db "code.fnuoos.com/zhimeng/model.git/src"
- "github.com/gin-gonic/gin"
- )
-
- // BasicSet
- // @Summary 基础设置
- // @Tags 设置中心-基础设置
- // @Description 基础设置-设置
- // @param Authorization header string true "验证参数Bearer和token空格拼接"
- // @Accept json
- // @Produce json
- // @Param args body md.BasicSetReq true "请求参数"
- // @Success 200 {string} "success"
- // @Failure 400 {object} md.Response "具体错误"
- // @Router /api/setCenter/basicSet [POST]
- func BasicSet(c *gin.Context) {
- var req md.BasicSetReq
- 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(enum.AppName, req.AppName)
- sysCfgDb.SysCfgUpdate(enum.AppLogo, req.AppLogo)
- e.OutSuc(c, "success", nil)
- return
- }
-
- // BasicGet
- // @Summary 基础设置
- // @Tags 设置中心-基础设置
- // @Description 基础设置-获取
- // @param Authorization header string true "验证参数Bearer和token空格拼接"
- // @Accept json
- // @Produce json
- // @Success 200 {string} "success"
- // @Failure 400 {object} md.Response "具体错误"
- // @Router /api/setCenter/basicGet [GET]
- func BasicGet(c *gin.Context) {
- masterId := svc.GetMasterId(c)
- engine := db.DBs[masterId]
- sysCfgDb := implement2.NewSysCfgDb(engine, masterId)
- res := sysCfgDb.SysCfgFindWithDb(enum.AppLogo, enum.AppName)
-
- e.OutSuc(c, md.BasicSetResp{
- AppName: res[enum.AppName],
- AppLogo: res[enum.AppLogo],
- }, nil)
- return
- }
|