广告平台(总站长使用)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

63 lines
1.8 KiB

  1. package hdl
  2. import (
  3. implement2 "applet/app/db/implement"
  4. "applet/app/e"
  5. "applet/app/enum"
  6. "applet/app/lib/validate"
  7. "applet/app/md"
  8. db "code.fnuoos.com/zhimeng/model.git/src"
  9. "github.com/gin-gonic/gin"
  10. )
  11. // BasicSet
  12. // @Summary 基础设置
  13. // @Tags 设置中心-基础设置
  14. // @Description 基础设置-设置
  15. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  16. // @Accept json
  17. // @Produce json
  18. // @Param args body md.BasicSetReq true "请求参数"
  19. // @Success 200 {string} "success"
  20. // @Failure 400 {object} md.Response "具体错误"
  21. // @Router /api/setCenter/basicSet [POST]
  22. func BasicSet(c *gin.Context) {
  23. var req md.BasicSetReq
  24. err := c.ShouldBindJSON(&req)
  25. if err != nil {
  26. err = validate.HandleValidateErr(err)
  27. err1 := err.(e.E)
  28. e.OutErr(c, err1.Code, err1.Error())
  29. return
  30. }
  31. masterId := "0"
  32. engine := db.Db
  33. sysCfgDb := implement2.NewSysCfgDb(engine, masterId)
  34. sysCfgDb.SysCfgUpdate(enum.AppName, req.AppName)
  35. sysCfgDb.SysCfgUpdate(enum.AppLogo, req.AppLogo)
  36. e.OutSuc(c, "success", nil)
  37. return
  38. }
  39. // BasicGet
  40. // @Summary 基础设置
  41. // @Tags 设置中心-基础设置
  42. // @Description 基础设置-获取
  43. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  44. // @Accept json
  45. // @Produce json
  46. // @Success 200 {string} "success"
  47. // @Failure 400 {object} md.Response "具体错误"
  48. // @Router /api/setCenter/basicGet [GET]
  49. func BasicGet(c *gin.Context) {
  50. engine := db.Db
  51. sysCfgDb := implement2.NewSysCfgDb(engine, "0")
  52. res := sysCfgDb.SysCfgFindWithDb(enum.AppLogo, enum.AppName)
  53. e.OutSuc(c, md.BasicSetResp{
  54. AppName: res[enum.AppName],
  55. AppLogo: res[enum.AppLogo],
  56. }, nil)
  57. return
  58. }