蛋蛋星球 后台端
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.

hdl_basic.go 2.0 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. package web
  2. import (
  3. "applet/app/e"
  4. "applet/app/md/setCenter"
  5. "applet/app/svc"
  6. "github.com/gin-gonic/gin"
  7. )
  8. // GetBasic
  9. // @Summary 基础设置-网站信息-基本设置(获取)
  10. // @Tags 基础设置
  11. // @Description 网站信息-基本设置(获取)
  12. // @Accept json
  13. // @Produce json
  14. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  15. // @Success 200 {object} setCenter.WebBasicResp "设置列表"
  16. // @Failure 400 {object} md.Response "具体错误"
  17. // @Router /api/settCenter/web/getBasic [get]
  18. func GetBasic(c *gin.Context) {
  19. resp := setCenter.WebBasicResp{
  20. SeoTitle: svc.GetSysCfgStr("seo_title"),
  21. SeoLogo: svc.GetSysCfgStr("seo_logo"),
  22. SeoLogoUrl: svc.GetOssUrl(svc.GetSysCfgStr("seo_logo")),
  23. WebLogo: svc.GetSysCfgStr("web_logo"),
  24. WebLogoUrl: svc.GetOssUrl(svc.GetSysCfgStr("web_logo")),
  25. WapHost: svc.GetOssUrl(svc.GetSysCfgStr("wap_host")),
  26. }
  27. e.OutSuc(c, resp, nil)
  28. }
  29. // SetBasic
  30. // @Summary 基础设置-网站信息-基本设置(更新)
  31. // @Tags 基础设置
  32. // @Description 基本设置(更新)
  33. // @Accept json
  34. // @Produce json
  35. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  36. // @param req body setCenter.WebBasicReq true "上传需要修改的信息"
  37. // @Success 200 {string} "success"
  38. // @Failure 400 {object} md.Response "具体错误"
  39. // @Router /api/settCenter/web/setBasic [post]
  40. func SetBasic(c *gin.Context) {
  41. var req *setCenter.WebBasicReq
  42. if err1 := c.ShouldBindJSON(&req); err1 != nil {
  43. e.OutErr(c, e.ERR_INVALID_ARGS, err1.Error())
  44. return
  45. }
  46. if req.WebLogo != "" {
  47. svc.SetSysCfgStr("web_logo", req.WebLogo)
  48. }
  49. if req.WapHost != "" {
  50. svc.SetSysCfgStr("wap_host", req.WapHost)
  51. }
  52. if req.SeoLogo != "" {
  53. svc.SetSysCfgStr("seo_logo", req.SeoLogo)
  54. }
  55. if req.SeoTitle != "" {
  56. svc.SetSysCfgStr("seo_title", req.SeoTitle)
  57. }
  58. e.OutSuc(c, "success", nil)
  59. return
  60. }