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

73 lines
2.3 KiB

  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. AndroidDownUrl: svc.GetSysCfgStr("android_down_url"),
  27. IosDownUrl: svc.GetSysCfgStr("ios_down_url"),
  28. }
  29. e.OutSuc(c, resp, nil)
  30. }
  31. // SetBasic
  32. // @Summary 基础设置-网站信息-基本设置(更新)
  33. // @Tags 基础设置
  34. // @Description 基本设置(更新)
  35. // @Accept json
  36. // @Produce json
  37. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  38. // @param req body setCenter.WebBasicReq true "上传需要修改的信息"
  39. // @Success 200 {string} "success"
  40. // @Failure 400 {object} md.Response "具体错误"
  41. // @Router /api/settCenter/web/setBasic [post]
  42. func SetBasic(c *gin.Context) {
  43. var req *setCenter.WebBasicReq
  44. if err1 := c.ShouldBindJSON(&req); err1 != nil {
  45. e.OutErr(c, e.ERR_INVALID_ARGS, err1.Error())
  46. return
  47. }
  48. if req.WebLogo != "" {
  49. svc.SetSysCfgStr("web_logo", req.WebLogo)
  50. }
  51. if req.WapHost != "" {
  52. svc.SetSysCfgStr("wap_host", req.WapHost)
  53. }
  54. if req.SeoLogo != "" {
  55. svc.SetSysCfgStr("seo_logo", req.SeoLogo)
  56. }
  57. if req.SeoTitle != "" {
  58. svc.SetSysCfgStr("seo_title", req.SeoTitle)
  59. }
  60. if req.AndroidDownUrl != "" {
  61. svc.SetSysCfgStr("android_down_url", req.AndroidDownUrl)
  62. }
  63. if req.IosDownUrl != "" {
  64. svc.SetSysCfgStr("ios_down_url", req.IosDownUrl)
  65. }
  66. e.OutSuc(c, "success", nil)
  67. return
  68. }