|
- package web
-
- import (
- "applet/app/e"
- "applet/app/md/setCenter"
- "applet/app/svc"
- "github.com/gin-gonic/gin"
- )
-
- // GetBasic
- // @Summary 基础设置-网站信息-基本设置(获取)
- // @Tags 基础设置
- // @Description 网站信息-基本设置(获取)
- // @Accept json
- // @Produce json
- // @param Authorization header string true "验证参数Bearer和token空格拼接"
- // @Success 200 {object} setCenter.WebBasicResp "设置列表"
- // @Failure 400 {object} md.Response "具体错误"
- // @Router /api/settCenter/web/getBasic [get]
- func GetBasic(c *gin.Context) {
- resp := setCenter.WebBasicResp{
- SeoTitle: svc.GetSysCfgStr("seo_title"),
- SeoLogo: svc.GetSysCfgStr("seo_logo"),
- SeoLogoUrl: svc.GetOssUrl(svc.GetSysCfgStr("seo_logo")),
- WebLogo: svc.GetSysCfgStr("web_logo"),
- WebLogoUrl: svc.GetOssUrl(svc.GetSysCfgStr("web_logo")),
- WapHost: svc.GetOssUrl(svc.GetSysCfgStr("wap_host")),
- AndroidDownUrl: svc.GetSysCfgStr("android_down_url"),
- IosDownUrl: svc.GetSysCfgStr("ios_down_url"),
- }
-
- e.OutSuc(c, resp, nil)
- }
-
- // SetBasic
- // @Summary 基础设置-网站信息-基本设置(更新)
- // @Tags 基础设置
- // @Description 基本设置(更新)
- // @Accept json
- // @Produce json
- // @param Authorization header string true "验证参数Bearer和token空格拼接"
- // @param req body setCenter.WebBasicReq true "上传需要修改的信息"
- // @Success 200 {string} "success"
- // @Failure 400 {object} md.Response "具体错误"
- // @Router /api/settCenter/web/setBasic [post]
- func SetBasic(c *gin.Context) {
- var req *setCenter.WebBasicReq
- if err1 := c.ShouldBindJSON(&req); err1 != nil {
- e.OutErr(c, e.ERR_INVALID_ARGS, err1.Error())
- return
- }
- if req.WebLogo != "" {
- svc.SetSysCfgStr("web_logo", req.WebLogo)
- }
- if req.WapHost != "" {
- svc.SetSysCfgStr("wap_host", req.WapHost)
- }
- if req.SeoLogo != "" {
- svc.SetSysCfgStr("seo_logo", req.SeoLogo)
- }
- if req.SeoTitle != "" {
- svc.SetSysCfgStr("seo_title", req.SeoTitle)
- }
- if req.AndroidDownUrl != "" {
- svc.SetSysCfgStr("android_down_url", req.AndroidDownUrl)
- }
- if req.IosDownUrl != "" {
- svc.SetSysCfgStr("ios_down_url", req.IosDownUrl)
- }
- e.OutSuc(c, "success", nil)
- return
- }
|