@@ -0,0 +1,72 @@ | |||
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")), | |||
} | |||
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 != "" { | |||
bools := svc.SetSysCfgStr("web_logo", req.WebLogo) | |||
if bools == false { | |||
e.OutErr(c, 400, e.NewErr(400, "保存失败")) | |||
return | |||
} | |||
} | |||
if req.SeoLogo != "" { | |||
bools := svc.SetSysCfgStr("seo_logo", req.SeoLogo) | |||
if bools == false { | |||
e.OutErr(c, 400, e.NewErr(400, "保存失败")) | |||
return | |||
} | |||
} | |||
if req.SeoTitle != "" { | |||
bools := svc.SetSysCfgStr("seo_title", req.SeoTitle) | |||
if bools == false { | |||
e.OutErr(c, 400, e.NewErr(400, "保存失败")) | |||
return | |||
} | |||
} | |||
e.OutSuc(c, "success", nil) | |||
return | |||
} |
@@ -0,0 +1,14 @@ | |||
package setCenter | |||
type WebBasicResp struct { | |||
SeoTitle string `json:"seo_title"` | |||
SeoLogo string `json:"seo_logo"` | |||
SeoLogoUrl string `json:"seo_logo_url"` | |||
WebLogo string `json:"web_logo"` | |||
WebLogoUrl string `json:"web_logo_url"` | |||
} | |||
type WebBasicReq struct { | |||
SeoTitle string `json:"seo_title"` | |||
SeoLogo string `json:"seo_logo"` | |||
WebLogo string `json:"web_logo"` | |||
} |
@@ -19,6 +19,7 @@ import ( | |||
"applet/app/hdl/member_center" | |||
"applet/app/hdl/notice" | |||
"applet/app/hdl/setCenter/oss/aliyun" | |||
"applet/app/hdl/setCenter/web" | |||
"applet/app/hdl/user_feedback" | |||
"applet/app/hdl/user_real_name" | |||
"applet/app/mw" | |||
@@ -102,6 +103,11 @@ func rSettCenter(r *gin.RouterGroup) { //设置中心 | |||
rOssAliYun.POST("/setBasic", aliyun.SetBasic) | |||
} | |||
} | |||
rWeb := r.Group("/web") //网站信息 | |||
{ | |||
rWeb.GET("/getBasic", web.GetBasic) | |||
rWeb.POST("/setBasic", web.SetBasic) | |||
} | |||
} | |||
func rHomePage(r *gin.RouterGroup) { | |||
r.GET("/totalData", hdl.GetTotalData) | |||
@@ -112,8 +112,9 @@ func Build(c *gin.Context) { | |||
} | |||
token := "aaaaaa" | |||
masterKey := "master" | |||
domain := svc.GetSysCfgStr("admin_host") | |||
domain := "http://" + c.Request.Host | |||
if cfg.Prd == false { | |||
domain = svc.GetSysCfgStr("admin_host") | |||
masterKey = "dev" | |||
} | |||
url := "http://120.76.175.204:8080/job/" + keys + "/buildWithParameters?version=" + req.Version + "×tamp=" + utils.Int64ToStr(time.Now().Unix()) + "&token=" + token + "&branch=" + masterKey + "&domain=" + php2go.URLEncode(domain) | |||
@@ -33,7 +33,20 @@ func GetSysCfgStr(key string) string { | |||
redisConn := cache.GetPool().Get() | |||
sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn) | |||
return sysCfgDb.SysCfgGetWithDb(key) | |||
} | |||
func SetSysCfgStr(key, val string) bool { | |||
redisConn := cache.GetPool().Get() | |||
cfgDb := implement.NewSysCfgDb(db.Db, redisConn) | |||
var bools bool | |||
if val != "" { | |||
data, _ := cfgDb.SysCfgGetOne(key) | |||
if data == nil { | |||
bools = cfgDb.SysCfgInsert(key, val, "") | |||
} else { | |||
bools = cfgDb.SysCfgUpdate(key, val) | |||
} | |||
} | |||
return bools | |||
} | |||
func CreateSTSClient(accessKeyId *string, accessKeySecret *string, stsEndpoint *string) (*sts20150401.Client, error) { | |||
@@ -1,4 +1,5 @@ | |||
// Package docs Code generated by swaggo/swag. DO NOT EDIT | |||
// Code generated by swaggo/swag. DO NOT EDIT. | |||
package docs | |||
import "github.com/swaggo/swag" | |||
@@ -1437,7 +1438,9 @@ const docTemplate = `{ | |||
"name": "req", | |||
"in": "body", | |||
"required": true, | |||
"schema": {} | |||
"schema": { | |||
"type": "object" | |||
} | |||
} | |||
], | |||
"responses": { | |||
@@ -6964,6 +6967,91 @@ const docTemplate = `{ | |||
} | |||
} | |||
}, | |||
"/api/settCenter/web/getBasic": { | |||
"get": { | |||
"description": "网站信息-基本设置(获取)", | |||
"consumes": [ | |||
"application/json" | |||
], | |||
"produces": [ | |||
"application/json" | |||
], | |||
"tags": [ | |||
"基础设置" | |||
], | |||
"summary": "基础设置-网站信息-基本设置(获取)", | |||
"parameters": [ | |||
{ | |||
"type": "string", | |||
"description": "验证参数Bearer和token空格拼接", | |||
"name": "Authorization", | |||
"in": "header", | |||
"required": true | |||
} | |||
], | |||
"responses": { | |||
"200": { | |||
"description": "设置列表", | |||
"schema": { | |||
"$ref": "#/definitions/setCenter.WebBasicResp" | |||
} | |||
}, | |||
"400": { | |||
"description": "具体错误", | |||
"schema": { | |||
"$ref": "#/definitions/md.Response" | |||
} | |||
} | |||
} | |||
} | |||
}, | |||
"/api/settCenter/web/setBasic": { | |||
"post": { | |||
"description": "基本设置(更新)", | |||
"consumes": [ | |||
"application/json" | |||
], | |||
"produces": [ | |||
"application/json" | |||
], | |||
"tags": [ | |||
"基础设置" | |||
], | |||
"summary": "基础设置-网站信息-基本设置(更新)", | |||
"parameters": [ | |||
{ | |||
"type": "string", | |||
"description": "验证参数Bearer和token空格拼接", | |||
"name": "Authorization", | |||
"in": "header", | |||
"required": true | |||
}, | |||
{ | |||
"description": "上传需要修改的信息", | |||
"name": "req", | |||
"in": "body", | |||
"required": true, | |||
"schema": { | |||
"$ref": "#/definitions/setCenter.WebBasicReq" | |||
} | |||
} | |||
], | |||
"responses": { | |||
"200": { | |||
"description": "success", | |||
"schema": { | |||
"type": "string" | |||
} | |||
}, | |||
"400": { | |||
"description": "具体错误", | |||
"schema": { | |||
"$ref": "#/definitions/md.Response" | |||
} | |||
} | |||
} | |||
} | |||
}, | |||
"/api/userFeedback/cate/list": { | |||
"post": { | |||
"description": "分类列表", | |||
@@ -14403,6 +14491,40 @@ const docTemplate = `{ | |||
"type": "integer" | |||
} | |||
} | |||
}, | |||
"setCenter.WebBasicReq": { | |||
"type": "object", | |||
"properties": { | |||
"seo_logo": { | |||
"type": "string" | |||
}, | |||
"seo_title": { | |||
"type": "string" | |||
}, | |||
"web_logo": { | |||
"type": "string" | |||
} | |||
} | |||
}, | |||
"setCenter.WebBasicResp": { | |||
"type": "object", | |||
"properties": { | |||
"seo_logo": { | |||
"type": "string" | |||
}, | |||
"seo_logo_url": { | |||
"type": "string" | |||
}, | |||
"seo_title": { | |||
"type": "string" | |||
}, | |||
"web_logo": { | |||
"type": "string" | |||
}, | |||
"web_logo_url": { | |||
"type": "string" | |||
} | |||
} | |||
} | |||
}, | |||
"securityDefinitions": { | |||
@@ -14424,8 +14546,6 @@ var SwaggerInfo = &swag.Spec{ | |||
Description: "管理后台接口文档", | |||
InfoInstanceName: "swagger", | |||
SwaggerTemplate: docTemplate, | |||
LeftDelim: "{{", | |||
RightDelim: "}}", | |||
} | |||
func init() { | |||
@@ -1430,7 +1430,9 @@ | |||
"name": "req", | |||
"in": "body", | |||
"required": true, | |||
"schema": {} | |||
"schema": { | |||
"type": "object" | |||
} | |||
} | |||
], | |||
"responses": { | |||
@@ -6957,6 +6959,91 @@ | |||
} | |||
} | |||
}, | |||
"/api/settCenter/web/getBasic": { | |||
"get": { | |||
"description": "网站信息-基本设置(获取)", | |||
"consumes": [ | |||
"application/json" | |||
], | |||
"produces": [ | |||
"application/json" | |||
], | |||
"tags": [ | |||
"基础设置" | |||
], | |||
"summary": "基础设置-网站信息-基本设置(获取)", | |||
"parameters": [ | |||
{ | |||
"type": "string", | |||
"description": "验证参数Bearer和token空格拼接", | |||
"name": "Authorization", | |||
"in": "header", | |||
"required": true | |||
} | |||
], | |||
"responses": { | |||
"200": { | |||
"description": "设置列表", | |||
"schema": { | |||
"$ref": "#/definitions/setCenter.WebBasicResp" | |||
} | |||
}, | |||
"400": { | |||
"description": "具体错误", | |||
"schema": { | |||
"$ref": "#/definitions/md.Response" | |||
} | |||
} | |||
} | |||
} | |||
}, | |||
"/api/settCenter/web/setBasic": { | |||
"post": { | |||
"description": "基本设置(更新)", | |||
"consumes": [ | |||
"application/json" | |||
], | |||
"produces": [ | |||
"application/json" | |||
], | |||
"tags": [ | |||
"基础设置" | |||
], | |||
"summary": "基础设置-网站信息-基本设置(更新)", | |||
"parameters": [ | |||
{ | |||
"type": "string", | |||
"description": "验证参数Bearer和token空格拼接", | |||
"name": "Authorization", | |||
"in": "header", | |||
"required": true | |||
}, | |||
{ | |||
"description": "上传需要修改的信息", | |||
"name": "req", | |||
"in": "body", | |||
"required": true, | |||
"schema": { | |||
"$ref": "#/definitions/setCenter.WebBasicReq" | |||
} | |||
} | |||
], | |||
"responses": { | |||
"200": { | |||
"description": "success", | |||
"schema": { | |||
"type": "string" | |||
} | |||
}, | |||
"400": { | |||
"description": "具体错误", | |||
"schema": { | |||
"$ref": "#/definitions/md.Response" | |||
} | |||
} | |||
} | |||
} | |||
}, | |||
"/api/userFeedback/cate/list": { | |||
"post": { | |||
"description": "分类列表", | |||
@@ -14396,6 +14483,40 @@ | |||
"type": "integer" | |||
} | |||
} | |||
}, | |||
"setCenter.WebBasicReq": { | |||
"type": "object", | |||
"properties": { | |||
"seo_logo": { | |||
"type": "string" | |||
}, | |||
"seo_title": { | |||
"type": "string" | |||
}, | |||
"web_logo": { | |||
"type": "string" | |||
} | |||
} | |||
}, | |||
"setCenter.WebBasicResp": { | |||
"type": "object", | |||
"properties": { | |||
"seo_logo": { | |||
"type": "string" | |||
}, | |||
"seo_logo_url": { | |||
"type": "string" | |||
}, | |||
"seo_title": { | |||
"type": "string" | |||
}, | |||
"web_logo": { | |||
"type": "string" | |||
}, | |||
"web_logo_url": { | |||
"type": "string" | |||
} | |||
} | |||
} | |||
}, | |||
"securityDefinitions": { | |||
@@ -4776,6 +4776,28 @@ definitions: | |||
within_days: | |||
type: integer | |||
type: object | |||
setCenter.WebBasicReq: | |||
properties: | |||
seo_logo: | |||
type: string | |||
seo_title: | |||
type: string | |||
web_logo: | |||
type: string | |||
type: object | |||
setCenter.WebBasicResp: | |||
properties: | |||
seo_logo: | |||
type: string | |||
seo_logo_url: | |||
type: string | |||
seo_title: | |||
type: string | |||
web_logo: | |||
type: string | |||
web_logo_url: | |||
type: string | |||
type: object | |||
host: localhost:4001 | |||
info: | |||
contact: | |||
@@ -5719,7 +5741,8 @@ paths: | |||
in: body | |||
name: req | |||
required: true | |||
schema: {} | |||
schema: | |||
type: object | |||
produces: | |||
- application/json | |||
responses: | |||
@@ -9375,6 +9398,62 @@ paths: | |||
summary: 设置中心-对象存储-对象存储设置(更新) | |||
tags: | |||
- 对象存储 | |||
/api/settCenter/web/getBasic: | |||
get: | |||
consumes: | |||
- application/json | |||
description: 网站信息-基本设置(获取) | |||
parameters: | |||
- description: 验证参数Bearer和token空格拼接 | |||
in: header | |||
name: Authorization | |||
required: true | |||
type: string | |||
produces: | |||
- application/json | |||
responses: | |||
"200": | |||
description: 设置列表 | |||
schema: | |||
$ref: '#/definitions/setCenter.WebBasicResp' | |||
"400": | |||
description: 具体错误 | |||
schema: | |||
$ref: '#/definitions/md.Response' | |||
summary: 基础设置-网站信息-基本设置(获取) | |||
tags: | |||
- 基础设置 | |||
/api/settCenter/web/setBasic: | |||
post: | |||
consumes: | |||
- application/json | |||
description: 基本设置(更新) | |||
parameters: | |||
- description: 验证参数Bearer和token空格拼接 | |||
in: header | |||
name: Authorization | |||
required: true | |||
type: string | |||
- description: 上传需要修改的信息 | |||
in: body | |||
name: req | |||
required: true | |||
schema: | |||
$ref: '#/definitions/setCenter.WebBasicReq' | |||
produces: | |||
- application/json | |||
responses: | |||
"200": | |||
description: success | |||
schema: | |||
type: string | |||
"400": | |||
description: 具体错误 | |||
schema: | |||
$ref: '#/definitions/md.Response' | |||
summary: 基础设置-网站信息-基本设置(更新) | |||
tags: | |||
- 基础设置 | |||
/api/user_feedback/cate/del: | |||
post: | |||
consumes: | |||