|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- package hdl
-
- import (
- implement2 "applet/app/db/implement"
- "applet/app/e"
- "applet/app/enum"
- "applet/app/lib/validate"
- "applet/app/md"
- 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 := "0"
- engine := db.Db
- 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) {
- engine := db.Db
- sysCfgDb := implement2.NewSysCfgDb(engine, "0")
- res := sysCfgDb.SysCfgFindWithDb(enum.AppLogo, enum.AppName)
-
- e.OutSuc(c, md.BasicSetResp{
- AppName: res[enum.AppName],
- AppLogo: res[enum.AppLogo],
- }, nil)
- return
- }
|