diff --git a/app/hdl/setCenter/web/hdl_basic.go b/app/hdl/setCenter/web/hdl_basic.go index 00dac51..829113a 100644 --- a/app/hdl/setCenter/web/hdl_basic.go +++ b/app/hdl/setCenter/web/hdl_basic.go @@ -19,12 +19,14 @@ import ( // @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")), + 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) @@ -59,6 +61,12 @@ func SetBasic(c *gin.Context) { 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 } diff --git a/app/hdl/website/hdl_website.go b/app/hdl/website/hdl_website.go new file mode 100644 index 0000000..85246eb --- /dev/null +++ b/app/hdl/website/hdl_website.go @@ -0,0 +1,85 @@ +package website + +import ( + "applet/app/db" + "applet/app/e" + "applet/app/md" + "applet/app/svc" + "applet/app/utils" + "applet/app/utils/cache" + "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" + svc2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/svc" + "github.com/gin-gonic/gin" +) + +// WebsiteInfo +// @Summary 官网-基本信息 +// @Tags 官网 +// @Description 官网-基本信息 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Success 200 {object} md.WebsiteInfoResp "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/website/info [get] +func WebsiteInfo(c *gin.Context) { + res := md.WebsiteInfoResp{ + SeoTitle: svc.GetSysCfgStr("seo_title"), + SeoLogo: svc.GetOssUrl(svc.GetSysCfgStr("seo_logo")), + WebLogo: svc.GetOssUrl(svc.GetSysCfgStr("web_logo")), + AndroidDownUrl: svc.GetSysCfgStr("android_down_url"), + IosDownUrl: svc.GetSysCfgStr("ios_down_url"), + } + e.OutSuc(c, res, nil) + return +} + +// GetModuleSetting +// @Summary 页面样式 +// @Tags 页面样式 +// @Description 页面样式 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param mod_name_value query string true "页面名称类型值(15:官网 联系我们)" +// @Success 200 {object} md.GetModuleSettingResp "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/v1/website/getModuleSetting [GET] +func GetModuleSetting(c *gin.Context) { + modName := c.Query("mod_name_value") + modNameMap := map[string]string{ + "15": "website_about_us", + } + val, ok := modNameMap[modName] + if !ok { + e.OutErr(c, e.ERR_BAD_REQUEST, nil) + return + } + moduleStyleDb := implement.NewModuleStyleDb(db.Db) + moduleStyle, err := moduleStyleDb.ModuleStyleGetOneByParams(map[string]interface{}{ + "key": "mod_name", + "value": val, + }) + if err != nil { + e.OutErr(c, e.ERR_DB_ORM, err.Error()) + return + } + if moduleStyle == nil { + e.OutErr(c, e.ERR_NO_DATA, nil) + return + } + var dataMap interface{} + redisConn := cache.GetPool().Get() + scheme, domain := svc2.ImageBucket(db.Db, redisConn) + moduleStyle.Data = svc2.ImageFormatWithBucketForDataInfo(scheme, domain, moduleStyle.Data) + utils.Unserialize([]byte(moduleStyle.Data), &dataMap) + resp := md.GetModuleSettingResp{ + ModName: moduleStyle.ModName, + Position: moduleStyle.Position, + SkipIdentifier: moduleStyle.SkipIdentifier, + Title: moduleStyle.Title, + Subtitle: moduleStyle.Subtitle, + Data: dataMap, + } + e.OutSuc(c, resp, nil) +} diff --git a/app/md/md_module.go b/app/md/md_module.go index 77ffc3d..3e7913c 100644 --- a/app/md/md_module.go +++ b/app/md/md_module.go @@ -15,6 +15,7 @@ var Module = map[string]string{ "12": "withdraw", "13": "withdraw_account", "14": "user_real_name", + "15": "website_about_us", } var ModuleList = []map[string]interface{}{ {"name": "首页", "mod_name": "home_page", "value": "1"}, @@ -31,4 +32,5 @@ var ModuleList = []map[string]interface{}{ {"name": "提现页", "mod_name": "withdraw", "value": "12"}, {"name": "提现到账户", "mod_name": "withdraw_account", "value": "13"}, {"name": "实名认证", "mod_name": "user_real_name", "value": "14"}, + {"name": "官网联系我们", "mod_name": "website_about_us", "value": "15"}, } diff --git a/app/md/md_website.go b/app/md/md_website.go new file mode 100644 index 0000000..9c186ba --- /dev/null +++ b/app/md/md_website.go @@ -0,0 +1,17 @@ +package md + +type WebsiteInfoResp struct { + SeoTitle string `json:"seo_title" example:"seo"` + SeoLogo string `json:"seo_logo"` + WebLogo string `json:"web_logo"` + AndroidDownUrl string `json:"android_down_url"` + IosDownUrl string `json:"ios_down_url"` +} +type GetModuleSettingResp struct { + ModName string `json:"mod_name"` // 模块名称 + Position string `json:"position"` // 位置 + SkipIdentifier string `json:"skip_identifier"` // 跳转标识 + Title string `json:"title"` // 标题 + Subtitle string `json:"subtitle"` // 副标题 + Data interface{} `json:"data"` // 内容 +} diff --git a/app/md/setCenter/md_web.go b/app/md/setCenter/md_web.go index 8102f16..6027db1 100644 --- a/app/md/setCenter/md_web.go +++ b/app/md/setCenter/md_web.go @@ -1,16 +1,20 @@ 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"` - WapHost string `json:"wap_host" example:"h5域名"` + 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"` + WapHost string `json:"wap_host" example:"h5域名"` + AndroidDownUrl string `json:"android_down_url"` + IosDownUrl string `json:"ios_down_url"` } type WebBasicReq struct { - SeoTitle string `json:"seo_title"` - SeoLogo string `json:"seo_logo"` - WebLogo string `json:"web_logo"` - WapHost string `json:"wap_host" example:"h5域名"` + SeoTitle string `json:"seo_title"` + SeoLogo string `json:"seo_logo"` + WebLogo string `json:"web_logo"` + WapHost string `json:"wap_host" example:"h5域名"` + AndroidDownUrl string `json:"android_down_url"` + IosDownUrl string `json:"ios_down_url"` } diff --git a/app/router/router.go b/app/router/router.go index 8254886..57ec947 100644 --- a/app/router/router.go +++ b/app/router/router.go @@ -22,6 +22,7 @@ import ( "applet/app/hdl/setCenter/web" "applet/app/hdl/user_feedback" "applet/app/hdl/user_real_name" + "applet/app/hdl/website" "applet/app/mw" _ "applet/docs" "github.com/gin-gonic/gin" @@ -73,7 +74,15 @@ func route(r *gin.RouterGroup) { r.POST("/cloudBundle/update/state", cloud_bundle.UpdateState) //打包更新状态 r.POST("/cloudBundle/upload", cloud_bundle.Upload) //打包 上传apk r.GET("/getSTSVoucher", comm.GetSTSVoucher) // 获取 STS 凭证 + //这里是官网的接口 + rWebsite := r.Group("/website") //官网信息 + { + rWebsite.GET("/info", website.WebsiteInfo) // 官网 + rWebsite.GET("/getModuleSetting", website.GetModuleSetting) // 获取页面样式 + } + } + r.Use(mw.Auth) // 以下接口需要JWT验证 rComm(r.Group("/comm")) r.GET("/config", hdl.Config) diff --git a/docs/docs.go b/docs/docs.go index 5763c84..04b4b0a 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -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": { @@ -7509,6 +7512,89 @@ const docTemplate = `{ } } } + }, + "/api/v1/website/getModuleSetting": { + "get": { + "description": "页面样式", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "页面样式" + ], + "summary": "页面样式", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "type": "string", + "description": "页面名称类型值(15:官网 联系我们)", + "name": "mod_name_value", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "具体数据", + "schema": { + "$ref": "#/definitions/md.GetModuleSettingResp" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, + "/api/website/info": { + "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/md.WebsiteInfoResp" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } } }, "definitions": { @@ -10473,6 +10559,34 @@ const docTemplate = `{ } } }, + "md.GetModuleSettingResp": { + "type": "object", + "properties": { + "data": { + "description": "内容" + }, + "mod_name": { + "description": "模块名称", + "type": "string" + }, + "position": { + "description": "位置", + "type": "string" + }, + "skip_identifier": { + "description": "跳转标识", + "type": "string" + }, + "subtitle": { + "description": "副标题", + "type": "string" + }, + "title": { + "description": "标题", + "type": "string" + } + } + }, "md.GetOneLevelResp": { "type": "object", "properties": { @@ -14204,6 +14318,27 @@ const docTemplate = `{ } } }, + "md.WebsiteInfoResp": { + "type": "object", + "properties": { + "android_down_url": { + "type": "string" + }, + "ios_down_url": { + "type": "string" + }, + "seo_logo": { + "type": "string" + }, + "seo_title": { + "type": "string", + "example": "seo" + }, + "web_logo": { + "type": "string" + } + } + }, "md.WithdrawApplyAuditReq": { "type": "object", "required": [ @@ -14383,6 +14518,12 @@ const docTemplate = `{ "setCenter.WebBasicReq": { "type": "object", "properties": { + "android_down_url": { + "type": "string" + }, + "ios_down_url": { + "type": "string" + }, "seo_logo": { "type": "string" }, @@ -14401,6 +14542,12 @@ const docTemplate = `{ "setCenter.WebBasicResp": { "type": "object", "properties": { + "android_down_url": { + "type": "string" + }, + "ios_down_url": { + "type": "string" + }, "seo_logo": { "type": "string" }, @@ -14442,8 +14589,6 @@ var SwaggerInfo = &swag.Spec{ Description: "管理后台接口文档", InfoInstanceName: "swagger", SwaggerTemplate: docTemplate, - LeftDelim: "{{", - RightDelim: "}}", } func init() { diff --git a/docs/swagger.json b/docs/swagger.json index 90e5017..65e75a0 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -1430,7 +1430,9 @@ "name": "req", "in": "body", "required": true, - "schema": {} + "schema": { + "type": "object" + } } ], "responses": { @@ -7502,6 +7504,89 @@ } } } + }, + "/api/v1/website/getModuleSetting": { + "get": { + "description": "页面样式", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "页面样式" + ], + "summary": "页面样式", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "type": "string", + "description": "页面名称类型值(15:官网 联系我们)", + "name": "mod_name_value", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "具体数据", + "schema": { + "$ref": "#/definitions/md.GetModuleSettingResp" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, + "/api/website/info": { + "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/md.WebsiteInfoResp" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } } }, "definitions": { @@ -10466,6 +10551,34 @@ } } }, + "md.GetModuleSettingResp": { + "type": "object", + "properties": { + "data": { + "description": "内容" + }, + "mod_name": { + "description": "模块名称", + "type": "string" + }, + "position": { + "description": "位置", + "type": "string" + }, + "skip_identifier": { + "description": "跳转标识", + "type": "string" + }, + "subtitle": { + "description": "副标题", + "type": "string" + }, + "title": { + "description": "标题", + "type": "string" + } + } + }, "md.GetOneLevelResp": { "type": "object", "properties": { @@ -14197,6 +14310,27 @@ } } }, + "md.WebsiteInfoResp": { + "type": "object", + "properties": { + "android_down_url": { + "type": "string" + }, + "ios_down_url": { + "type": "string" + }, + "seo_logo": { + "type": "string" + }, + "seo_title": { + "type": "string", + "example": "seo" + }, + "web_logo": { + "type": "string" + } + } + }, "md.WithdrawApplyAuditReq": { "type": "object", "required": [ @@ -14376,6 +14510,12 @@ "setCenter.WebBasicReq": { "type": "object", "properties": { + "android_down_url": { + "type": "string" + }, + "ios_down_url": { + "type": "string" + }, "seo_logo": { "type": "string" }, @@ -14394,6 +14534,12 @@ "setCenter.WebBasicResp": { "type": "object", "properties": { + "android_down_url": { + "type": "string" + }, + "ios_down_url": { + "type": "string" + }, "seo_logo": { "type": "string" }, diff --git a/docs/swagger.yaml b/docs/swagger.yaml index ca1809b..f30e7ac 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -2042,6 +2042,26 @@ definitions: paginate: $ref: '#/definitions/applet_app_md_member_center.Paginate' type: object + md.GetModuleSettingResp: + properties: + data: + description: 内容 + mod_name: + description: 模块名称 + type: string + position: + description: 位置 + type: string + skip_identifier: + description: 跳转标识 + type: string + subtitle: + description: 副标题 + type: string + title: + description: 标题 + type: string + type: object md.GetOneLevelResp: properties: auto_update: @@ -4647,6 +4667,20 @@ definitions: example: 货币类型名称 type: string type: object + md.WebsiteInfoResp: + properties: + android_down_url: + type: string + ios_down_url: + type: string + seo_logo: + type: string + seo_title: + example: seo + type: string + web_logo: + type: string + type: object md.WithdrawApplyAuditReq: properties: audit_state: @@ -4767,6 +4801,10 @@ definitions: type: object setCenter.WebBasicReq: properties: + android_down_url: + type: string + ios_down_url: + type: string seo_logo: type: string seo_title: @@ -4779,6 +4817,10 @@ definitions: type: object setCenter.WebBasicResp: properties: + android_down_url: + type: string + ios_down_url: + type: string seo_logo: type: string seo_logo_url: @@ -5736,7 +5778,8 @@ paths: in: body name: req required: true - schema: {} + schema: + type: object produces: - application/json responses: @@ -9752,6 +9795,61 @@ paths: summary: 基本设置-实名认证-修改认证状态 tags: - 基本设置 + /api/v1/website/getModuleSetting: + get: + consumes: + - application/json + description: 页面样式 + parameters: + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization + required: true + type: string + - description: 页面名称类型值(15:官网 联系我们) + in: query + name: mod_name_value + required: true + type: string + produces: + - application/json + responses: + "200": + description: 具体数据 + schema: + $ref: '#/definitions/md.GetModuleSettingResp' + "400": + description: 具体错误 + schema: + $ref: '#/definitions/md.Response' + summary: 页面样式 + tags: + - 页面样式 + /api/website/info: + 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/md.WebsiteInfoResp' + "400": + description: 具体错误 + schema: + $ref: '#/definitions/md.Response' + summary: 官网-基本信息 + tags: + - 官网 securityDefinitions: MasterID: in: header