@@ -0,0 +1,57 @@ | |||
package hdl | |||
import ( | |||
"applet/app/db" | |||
"applet/app/e" | |||
"applet/app/md" | |||
"applet/app/utils" | |||
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement" | |||
"github.com/gin-gonic/gin" | |||
) | |||
// GetModuleSetting | |||
// @Summary 页面样式 | |||
// @Tags 页面样式 | |||
// @Description 页面样式 | |||
// @Accept json | |||
// @Produce json | |||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||
// @Param mod_name_value query string true "页面名称类型值(1:home_page 2:member_center 3:bottom_bar 4:invitation_download_landing_page 5:invitation_poster)" | |||
// @Success 200 {object} md.GetModuleSettingResp "具体数据" | |||
// @Failure 400 {object} md.Response "具体错误" | |||
// @Router /api/v1/getModuleSetting [GET] | |||
func GetModuleSetting(c *gin.Context) { | |||
modName := c.Query("mod_name_value") | |||
modNameMap := map[string]string{ | |||
"1": "home_page", | |||
"2": "member_center", | |||
"3": "bottom_bar", | |||
"4": "invitation_download_landing_page", | |||
"5": "invitation_poster", | |||
} | |||
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 | |||
} | |||
var dataMap map[string]interface{} | |||
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) | |||
} |
@@ -1,13 +1,6 @@ | |||
package hdl | |||
import ( | |||
"applet/app/db" | |||
"applet/app/e" | |||
"applet/app/md" | |||
"applet/app/svc" | |||
"applet/app/utils" | |||
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement" | |||
"fmt" | |||
"github.com/gin-gonic/gin" | |||
) | |||
@@ -22,24 +15,24 @@ import ( | |||
// @Failure 400 {object} md.Response "具体错误" | |||
// @Router /api/v1/config [get] | |||
func Config(c *gin.Context) { | |||
res := md.ConfigResp{} | |||
eg := db.Db | |||
NewArticleDb := implement.NewArticleDb(eg) | |||
article, _ := NewArticleDb.ArticleCateByTypeId("1") | |||
if article != nil { | |||
res.Title = article.Title | |||
res.Content = article.Content | |||
} | |||
userArticle, _ := NewArticleDb.ArticleCateByTypeId("2") | |||
if userArticle != nil { | |||
res.UserTitle = userArticle.Title | |||
res.UserUrl = fmt.Sprintf("%s%s?article_id=%s", svc.GetSysCfgStr("wap_host"), "/api/v1/article/html", utils.AnyToString(userArticle.Id)) | |||
} | |||
privacyArticle, _ := NewArticleDb.ArticleCateByTypeId("3") | |||
if privacyArticle != nil { | |||
res.PrivacyTitle = privacyArticle.Title | |||
res.PrivacyUrl = fmt.Sprintf("%s%s?article_id=%s", svc.GetSysCfgStr("wap_host"), "/api/v1/article/html", utils.AnyToString(userArticle.Id)) | |||
} | |||
e.OutSuc(c, res, nil) | |||
return | |||
//res := md.ConfigResp{} | |||
//eg := db.Db | |||
//NewArticleDb := implement.NewArticleDb(eg) | |||
//article, _ := NewArticleDb.ArticleCateByTypeId("1") | |||
//if article != nil { | |||
// res.Title = article.Title | |||
// res.Content = article.Content | |||
//} | |||
//userArticle, _ := NewArticleDb.ArticleCateByTypeId("2") | |||
//if userArticle != nil { | |||
// res.UserTitle = userArticle.Title | |||
// res.UserUrl = fmt.Sprintf("%s%s?article_id=%s", svc.GetSysCfgStr("wap_host"), "/api/v1/article/html", utils.AnyToString(userArticle.Id)) | |||
//} | |||
//privacyArticle, _ := NewArticleDb.ArticleCateByTypeId("3") | |||
//if privacyArticle != nil { | |||
// res.PrivacyTitle = privacyArticle.Title | |||
// res.PrivacyUrl = fmt.Sprintf("%s%s?article_id=%s", svc.GetSysCfgStr("wap_host"), "/api/v1/article/html", utils.AnyToString(userArticle.Id)) | |||
//} | |||
//e.OutSuc(c, res, nil) | |||
//return | |||
} |
@@ -0,0 +1,10 @@ | |||
package md | |||
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 map[string]interface{} `json:"data"` // 内容 | |||
} |
@@ -65,6 +65,7 @@ func route(r *gin.RouterGroup) { | |||
r.POST("/register", hdl.Register) //注册 | |||
r.POST("/login", hdl.Login) //登录 | |||
r.POST("/findPassword", hdl.FindPassword) //找回密码 | |||
r.GET("/getModuleSetting", hdl.GetModuleSetting) // 获取 | |||
r.Use(mw.Auth) // 以下接口需要JWT验证 | |||
rComm(r.Group("/comm")) | |||
r.GET("/userInfo", hdl.UserInfo) //用户基础信息 | |||
@@ -610,6 +610,51 @@ const docTemplate = `{ | |||
} | |||
} | |||
}, | |||
"/api/v1/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": "页面名称类型值(1:home_page 2:member_center 3:bottom_bar 4:invitation_download_landing_page 5:invitation_poster)", | |||
"name": "mod_name_value", | |||
"in": "query", | |||
"required": true | |||
} | |||
], | |||
"responses": { | |||
"200": { | |||
"description": "具体数据", | |||
"schema": { | |||
"$ref": "#/definitions/md.GetModuleSettingResp" | |||
} | |||
}, | |||
"400": { | |||
"description": "具体错误", | |||
"schema": { | |||
"$ref": "#/definitions/md.Response" | |||
} | |||
} | |||
} | |||
} | |||
}, | |||
"/api/v1/homePage/adRule": { | |||
"get": { | |||
"description": "视频奖励规则(获取)", | |||
@@ -2372,6 +2417,36 @@ const docTemplate = `{ | |||
} | |||
} | |||
}, | |||
"md.GetModuleSettingResp": { | |||
"type": "object", | |||
"properties": { | |||
"data": { | |||
"description": "内容", | |||
"type": "object", | |||
"additionalProperties": true | |||
}, | |||
"mod_name": { | |||
"description": "模块名称", | |||
"type": "string" | |||
}, | |||
"position": { | |||
"description": "位置", | |||
"type": "string" | |||
}, | |||
"skip_identifier": { | |||
"description": "跳转标识", | |||
"type": "string" | |||
}, | |||
"subtitle": { | |||
"description": "副标题", | |||
"type": "string" | |||
}, | |||
"title": { | |||
"description": "标题", | |||
"type": "string" | |||
} | |||
} | |||
}, | |||
"md.GetPriceCurveResp": { | |||
"type": "object", | |||
"properties": { | |||
@@ -604,6 +604,51 @@ | |||
} | |||
} | |||
}, | |||
"/api/v1/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": "页面名称类型值(1:home_page 2:member_center 3:bottom_bar 4:invitation_download_landing_page 5:invitation_poster)", | |||
"name": "mod_name_value", | |||
"in": "query", | |||
"required": true | |||
} | |||
], | |||
"responses": { | |||
"200": { | |||
"description": "具体数据", | |||
"schema": { | |||
"$ref": "#/definitions/md.GetModuleSettingResp" | |||
} | |||
}, | |||
"400": { | |||
"description": "具体错误", | |||
"schema": { | |||
"$ref": "#/definitions/md.Response" | |||
} | |||
} | |||
} | |||
} | |||
}, | |||
"/api/v1/homePage/adRule": { | |||
"get": { | |||
"description": "视频奖励规则(获取)", | |||
@@ -2366,6 +2411,36 @@ | |||
} | |||
} | |||
}, | |||
"md.GetModuleSettingResp": { | |||
"type": "object", | |||
"properties": { | |||
"data": { | |||
"description": "内容", | |||
"type": "object", | |||
"additionalProperties": true | |||
}, | |||
"mod_name": { | |||
"description": "模块名称", | |||
"type": "string" | |||
}, | |||
"position": { | |||
"description": "位置", | |||
"type": "string" | |||
}, | |||
"skip_identifier": { | |||
"description": "跳转标识", | |||
"type": "string" | |||
}, | |||
"subtitle": { | |||
"description": "副标题", | |||
"type": "string" | |||
}, | |||
"title": { | |||
"description": "标题", | |||
"type": "string" | |||
} | |||
} | |||
}, | |||
"md.GetPriceCurveResp": { | |||
"type": "object", | |||
"properties": { | |||
@@ -411,6 +411,28 @@ definitions: | |||
paginate: | |||
$ref: '#/definitions/applet_app_md.Paginate' | |||
type: object | |||
md.GetModuleSettingResp: | |||
properties: | |||
data: | |||
additionalProperties: true | |||
description: 内容 | |||
type: object | |||
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.GetPriceCurveResp: | |||
properties: | |||
x_data: | |||
@@ -1401,6 +1423,37 @@ paths: | |||
summary: 注册 | |||
tags: | |||
- 注册 | |||
/api/v1/getModuleSetting: | |||
get: | |||
consumes: | |||
- application/json | |||
description: 页面样式 | |||
parameters: | |||
- description: 验证参数Bearer和token空格拼接 | |||
in: header | |||
name: Authorization | |||
required: true | |||
type: string | |||
- description: 页面名称类型值(1:home_page 2:member_center 3:bottom_bar 4:invitation_download_landing_page | |||
5:invitation_poster) | |||
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/v1/homePage/adRule: | |||
get: | |||
consumes: | |||
@@ -32,7 +32,7 @@ require ( | |||
) | |||
require ( | |||
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241125145802-942cfd1ddd13 | |||
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241126074909-98c49e778178 | |||
code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241125081706-0915be3f4144 | |||
code.fnuoos.com/go_rely_warehouse/zyos_go_es.git v1.0.1-0.20241118083738-0f22da9ba0be | |||
code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5 | |||