|
- package web
-
- import (
- "applet/app/e"
- "applet/app/md/setCenter"
- "applet/app/svc"
- "applet/app/utils"
- "encoding/json"
- "github.com/gin-gonic/gin"
- "strings"
- )
-
- // 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
- }
-
- // GetDownDomainBasic
- // @Summary 基础设置-网站信息-下载页多域名设置(获取)
- // @Tags 基础设置
- // @Description 网站信息-下载页多域名设置(获取)
- // @Accept json
- // @Produce json
- // @param Authorization header string true "验证参数Bearer和token空格拼接"
- // @Success 200 {object} setCenter.WebDomainBasicReq "设置列表"
- // @Failure 400 {object} md.Response "具体错误"
- // @Router /api/settCenter/web/getDownDomainBasic [get]
- func GetDownDomainBasic(c *gin.Context) {
- domain := svc.GetSysCfgStr("down_web_domain")
- var tmp = make([]string, 0)
- json.Unmarshal([]byte(domain), &tmp)
- resp := setCenter.WebDomainBasicReq{
- WebDomain: tmp,
- }
- e.OutSuc(c, resp, nil)
- }
-
- // SetDownDomainBasic
- // @Summary 基础设置-网站信息-下载页多域名设置(更新)
- // @Tags 基础设置
- // @Description 下载页多域名设置(更新)
- // @Accept json
- // @Produce json
- // @param Authorization header string true "验证参数Bearer和token空格拼接"
- // @param req body setCenter.WebDomainBasicReq true "上传需要修改的信息"
- // @Success 200 {string} "success"
- // @Failure 400 {object} md.Response "具体错误"
- // @Router /api/settCenter/web/setDownDomainBasic [post]
- func SetDownDomainBasic(c *gin.Context) {
- var req *setCenter.WebDomainBasicReq
- if err1 := c.ShouldBindJSON(&req); err1 != nil {
- e.OutErr(c, e.ERR_INVALID_ARGS, err1.Error())
- return
- }
- domain := utils.SerializeStr(req.WebDomain)
- domain = strings.ReplaceAll(domain, "http://", "")
- domain = strings.ReplaceAll(domain, "https://", "")
- domain = strings.ReplaceAll(domain, "/", "")
- svc.SetSysCfgStr("down_web_domain", domain)
- e.OutSuc(c, "success", nil)
- return
- }
-
- // GetRegisterDomainBasic
- // @Summary 基础设置-网站信息-下载页多域名设置(获取)
- // @Tags 基础设置
- // @Description 网站信息-下载页多域名设置(获取)
- // @Accept json
- // @Produce json
- // @param Authorization header string true "验证参数Bearer和token空格拼接"
- // @Success 200 {object} setCenter.WebDomainBasicReq "设置列表"
- // @Failure 400 {object} md.Response "具体错误"
- // @Router /api/settCenter/web/getRegisterDomainBasic [get]
- func GetRegisterDomainBasic(c *gin.Context) {
- domain := svc.GetSysCfgStr("down_register_domain")
- var tmp = make([]string, 0)
- json.Unmarshal([]byte(domain), &tmp)
- downWebOpen := svc.GetSysCfgStr("down_web_open")
- resp := setCenter.WebDomainBasicReq{
- WebDomain: tmp,
- DownWebOpen: downWebOpen,
- }
- e.OutSuc(c, resp, nil)
- }
-
- // SetRegisterDomainBasic
- // @Summary 基础设置-网站信息-下载页多域名设置(更新)
- // @Tags 基础设置
- // @Description 下载页多域名设置(更新)
- // @Accept json
- // @Produce json
- // @param Authorization header string true "验证参数Bearer和token空格拼接"
- // @param req body setCenter.WebDomainBasicReq true "上传需要修改的信息"
- // @Success 200 {string} "success"
- // @Failure 400 {object} md.Response "具体错误"
- // @Router /api/settCenter/web/setRegisterDomainBasic [post]
- func SetRegisterDomainBasic(c *gin.Context) {
- var req *setCenter.WebDomainBasicReq
- if err1 := c.ShouldBindJSON(&req); err1 != nil {
- e.OutErr(c, e.ERR_INVALID_ARGS, err1.Error())
- return
- }
- domain := utils.SerializeStr(req.WebDomain)
- domain = strings.ReplaceAll(domain, "http://", "")
- domain = strings.ReplaceAll(domain, "https://", "")
- domain = strings.ReplaceAll(domain, "/", "")
- svc.SetSysCfgStr("down_web_open", req.DownWebOpen)
- svc.SetSysCfgStr("down_register_domain", domain)
- e.OutSuc(c, "success", nil)
- return
- }
|