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

162 lines
5.7 KiB

  1. package web
  2. import (
  3. "applet/app/e"
  4. "applet/app/md/setCenter"
  5. "applet/app/svc"
  6. "applet/app/utils"
  7. "encoding/json"
  8. "github.com/gin-gonic/gin"
  9. )
  10. // GetBasic
  11. // @Summary 基础设置-网站信息-基本设置(获取)
  12. // @Tags 基础设置
  13. // @Description 网站信息-基本设置(获取)
  14. // @Accept json
  15. // @Produce json
  16. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  17. // @Success 200 {object} setCenter.WebBasicResp "设置列表"
  18. // @Failure 400 {object} md.Response "具体错误"
  19. // @Router /api/settCenter/web/getBasic [get]
  20. func GetBasic(c *gin.Context) {
  21. resp := setCenter.WebBasicResp{
  22. SeoTitle: svc.GetSysCfgStr("seo_title"),
  23. SeoLogo: svc.GetSysCfgStr("seo_logo"),
  24. SeoLogoUrl: svc.GetOssUrl(svc.GetSysCfgStr("seo_logo")),
  25. WebLogo: svc.GetSysCfgStr("web_logo"),
  26. WebLogoUrl: svc.GetOssUrl(svc.GetSysCfgStr("web_logo")),
  27. WapHost: svc.GetOssUrl(svc.GetSysCfgStr("wap_host")),
  28. AndroidDownUrl: svc.GetSysCfgStr("android_down_url"),
  29. IosDownUrl: svc.GetSysCfgStr("ios_down_url"),
  30. }
  31. e.OutSuc(c, resp, nil)
  32. }
  33. // SetBasic
  34. // @Summary 基础设置-网站信息-基本设置(更新)
  35. // @Tags 基础设置
  36. // @Description 基本设置(更新)
  37. // @Accept json
  38. // @Produce json
  39. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  40. // @param req body setCenter.WebBasicReq true "上传需要修改的信息"
  41. // @Success 200 {string} "success"
  42. // @Failure 400 {object} md.Response "具体错误"
  43. // @Router /api/settCenter/web/setBasic [post]
  44. func SetBasic(c *gin.Context) {
  45. var req *setCenter.WebBasicReq
  46. if err1 := c.ShouldBindJSON(&req); err1 != nil {
  47. e.OutErr(c, e.ERR_INVALID_ARGS, err1.Error())
  48. return
  49. }
  50. if req.WebLogo != "" {
  51. svc.SetSysCfgStr("web_logo", req.WebLogo)
  52. }
  53. if req.WapHost != "" {
  54. svc.SetSysCfgStr("wap_host", req.WapHost)
  55. }
  56. if req.SeoLogo != "" {
  57. svc.SetSysCfgStr("seo_logo", req.SeoLogo)
  58. }
  59. if req.SeoTitle != "" {
  60. svc.SetSysCfgStr("seo_title", req.SeoTitle)
  61. }
  62. if req.AndroidDownUrl != "" {
  63. svc.SetSysCfgStr("android_down_url", req.AndroidDownUrl)
  64. }
  65. if req.IosDownUrl != "" {
  66. svc.SetSysCfgStr("ios_down_url", req.IosDownUrl)
  67. }
  68. e.OutSuc(c, "success", nil)
  69. return
  70. }
  71. // GetDownDomainBasic
  72. // @Summary 基础设置-网站信息-下载页多域名设置(获取)
  73. // @Tags 基础设置
  74. // @Description 网站信息-下载页多域名设置(获取)
  75. // @Accept json
  76. // @Produce json
  77. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  78. // @Success 200 {object} setCenter.WebDomainBasicReq "设置列表"
  79. // @Failure 400 {object} md.Response "具体错误"
  80. // @Router /api/settCenter/web/getDownDomainBasic [get]
  81. func GetDownDomainBasic(c *gin.Context) {
  82. domain := svc.GetSysCfgStr("down_web_domain")
  83. downWebOpen := svc.GetSysCfgStr("down_web_open")
  84. var tmp = make([]string, 0)
  85. json.Unmarshal([]byte(domain), &tmp)
  86. resp := setCenter.WebDomainBasicReq{
  87. WebDomain: tmp,
  88. DownWebOpen: downWebOpen,
  89. }
  90. e.OutSuc(c, resp, nil)
  91. }
  92. // SetDownDomainBasic
  93. // @Summary 基础设置-网站信息-下载页多域名设置(更新)
  94. // @Tags 基础设置
  95. // @Description 下载页多域名设置(更新)
  96. // @Accept json
  97. // @Produce json
  98. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  99. // @param req body setCenter.WebDomainBasicReq true "上传需要修改的信息"
  100. // @Success 200 {string} "success"
  101. // @Failure 400 {object} md.Response "具体错误"
  102. // @Router /api/settCenter/web/setDownDomainBasic [post]
  103. func SetDownDomainBasic(c *gin.Context) {
  104. var req *setCenter.WebDomainBasicReq
  105. if err1 := c.ShouldBindJSON(&req); err1 != nil {
  106. e.OutErr(c, e.ERR_INVALID_ARGS, err1.Error())
  107. return
  108. }
  109. svc.SetSysCfgStr("down_web_domain", utils.SerializeStr(req.WebDomain))
  110. svc.SetSysCfgStr("down_web_open", req.DownWebOpen)
  111. e.OutSuc(c, "success", nil)
  112. return
  113. }
  114. // GetRegisterDomainBasic
  115. // @Summary 基础设置-网站信息-下载页多域名设置(获取)
  116. // @Tags 基础设置
  117. // @Description 网站信息-下载页多域名设置(获取)
  118. // @Accept json
  119. // @Produce json
  120. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  121. // @Success 200 {object} setCenter.WebDomainBasicReq "设置列表"
  122. // @Failure 400 {object} md.Response "具体错误"
  123. // @Router /api/settCenter/web/getRegisterDomainBasic [get]
  124. func GetRegisterDomainBasic(c *gin.Context) {
  125. domain := svc.GetSysCfgStr("down_register_domain")
  126. var tmp = make([]string, 0)
  127. json.Unmarshal([]byte(domain), &tmp)
  128. resp := setCenter.WebDomainBasicReq{
  129. WebDomain: tmp,
  130. }
  131. e.OutSuc(c, resp, nil)
  132. }
  133. // SetRegisterDomainBasic
  134. // @Summary 基础设置-网站信息-下载页多域名设置(更新)
  135. // @Tags 基础设置
  136. // @Description 下载页多域名设置(更新)
  137. // @Accept json
  138. // @Produce json
  139. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  140. // @param req body setCenter.WebDomainBasicReq true "上传需要修改的信息"
  141. // @Success 200 {string} "success"
  142. // @Failure 400 {object} md.Response "具体错误"
  143. // @Router /api/settCenter/web/setRegisterDomainBasic [post]
  144. func SetRegisterDomainBasic(c *gin.Context) {
  145. var req *setCenter.WebDomainBasicReq
  146. if err1 := c.ShouldBindJSON(&req); err1 != nil {
  147. e.OutErr(c, e.ERR_INVALID_ARGS, err1.Error())
  148. return
  149. }
  150. svc.SetSysCfgStr("down_register_domain", utils.SerializeStr(req.WebDomain))
  151. e.OutSuc(c, "success", nil)
  152. return
  153. }