@@ -95,7 +95,7 @@ func GetOneLevel(c *gin.Context) { | |||
}, | |||
{ | |||
"name": enum.UserLevelTaskType.String(enum.DirectPushActiveDayNum), | |||
"value": enum.DirectPushMembersNum, | |||
"value": enum.DirectPushActiveDayNum, | |||
}, | |||
{ | |||
"name": enum.UserLevelTaskType.String(enum.DirectPushLevel), | |||
@@ -173,6 +173,9 @@ func AddLevelTask(c *gin.Context) { | |||
if req.TaskTypeLevelId != "" { | |||
task.TaskTypeLevelId = utils.StrToInt(req.TaskTypeLevelId) | |||
} | |||
if req.ActiveDays != "" { | |||
task.ActiveDays = utils.StrToInt(req.ActiveDays) | |||
} | |||
taskDb := implement.NewUserLevelTaskDb(db.Db) | |||
taskID, err := taskDb.UserLevelTaskInsert(&task) | |||
@@ -200,12 +203,13 @@ func UpdateLevelTask(c *gin.Context) { | |||
e.OutErr(c, e.ERR_INVALID_ARGS, err.Error()) | |||
return | |||
} | |||
var forceColumns []string | |||
task := &model.UserLevelTask{ | |||
Id: utils.StrToInt(req.TaskID), | |||
} | |||
if req.IsMustTask != "" { | |||
task.IsMustTask = utils.StrToInt(req.IsMustTask) | |||
forceColumns = append(forceColumns, "is_must_task") | |||
} | |||
if req.TaskType != "" { | |||
task.TaskType = utils.StrToInt(req.TaskType) | |||
@@ -219,9 +223,12 @@ func UpdateLevelTask(c *gin.Context) { | |||
if req.TaskTypeLevelId != "" { | |||
task.TaskTypeLevelId = utils.StrToInt(req.TaskTypeLevelId) | |||
} | |||
if req.ActiveDays != "" { | |||
task.ActiveDays = utils.StrToInt(req.ActiveDays) | |||
} | |||
taskDb := implement.NewUserLevelTaskDb(db.Db) | |||
affected, err := taskDb.UserLevelTaskUpdate(task) | |||
affected, err := taskDb.UserLevelTaskUpdate(task, forceColumns...) | |||
if err != nil { | |||
e.OutErr(c, e.ERR_DB_ORM, err.Error()) | |||
return | |||
@@ -246,7 +253,7 @@ func UpdateLevel(c *gin.Context) { | |||
e.OutErr(c, e.ERR_INVALID_ARGS, err.Error()) | |||
return | |||
} | |||
var forceColumns []string | |||
level := &model.UserLevel{ | |||
Id: utils.StrToInt(req.LevelID), | |||
LevelName: req.LevelName, | |||
@@ -255,17 +262,24 @@ func UpdateLevel(c *gin.Context) { | |||
} | |||
if req.LevelWeight != "" { | |||
level.LevelWeight = utils.StrToInt(req.LevelWeight) | |||
forceColumns = append(forceColumns, "level_weight") | |||
} | |||
if req.IsUse == "0" || req.IsUse == "1" { | |||
level.LevelWeight = utils.StrToInt(req.IsUse) | |||
forceColumns = append(forceColumns, "is_use") | |||
} | |||
if req.AutoUpdate == "0" || req.AutoUpdate == "1" { | |||
level.AutoUpdate = utils.StrToInt(req.AutoUpdate) | |||
forceColumns = append(forceColumns, "auto_update") | |||
} | |||
forceColumns := []string{"level_weight", "is_use"} | |||
levelDb := implement.NewUserLevelDb(db.Db) | |||
affected, err := levelDb.UserLevelUpdate(req.LevelID, level, forceColumns...) | |||
if err != nil { | |||
if err.Error() == "no columns found to be updated" { | |||
e.OutSuc(c, affected, nil) | |||
return | |||
} | |||
e.OutErr(c, e.ERR_DB_ORM, err.Error()) | |||
return | |||
} | |||
@@ -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 | |||
} |
@@ -35,6 +35,7 @@ type AddLevelTaskReq struct { | |||
TaskType string `json:"task_type"` // 1:直推会员人数,2:直推会员活跃天数,3:直推会员等级 | |||
WithinDays string `json:"within_days"` // 多少天内完成 | |||
FinishCount string `json:"finish_count"` // 多少天内完成的指标 | |||
ActiveDays string `json:"active_days"` // 活跃多少天 | |||
TaskTypeLevelId string `json:"task_type_level_id"` // 会员等级 ID (task_type=3时生效) | |||
} | |||
@@ -63,6 +64,7 @@ type UpdateLevelTaskReq struct { | |||
TaskType string `json:"task_type"` // 1:直推会员人数,2:直推会员活跃天数,3:直推会员等级 | |||
WithinDays string `json:"within_days"` // 多少天内完成 | |||
FinishCount string `json:"finish_count"` // 多少天内完成的指标 | |||
ActiveDays string `json:"active_days"` // 活跃多少天 | |||
TaskTypeLevelId string `json:"task_type_level_id"` // 会员等级 ID (task_type=3时生效) | |||
} | |||
@@ -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) { | |||
@@ -6964,6 +6964,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": "分类列表", | |||
@@ -8160,6 +8245,10 @@ const docTemplate = `{ | |||
"md.AddLevelTaskReq": { | |||
"type": "object", | |||
"properties": { | |||
"active_days": { | |||
"description": "活跃多少天", | |||
"type": "string" | |||
}, | |||
"finish_count": { | |||
"description": "多少天内完成的指标", | |||
"type": "string" | |||
@@ -11827,7 +11916,10 @@ const docTemplate = `{ | |||
"type": "string" | |||
}, | |||
"level": { | |||
"type": "string" | |||
"type": "array", | |||
"items": { | |||
"type": "string" | |||
} | |||
}, | |||
"platform": { | |||
"type": "string" | |||
@@ -12799,6 +12891,10 @@ const docTemplate = `{ | |||
"md.UpdateLevelTaskReq": { | |||
"type": "object", | |||
"properties": { | |||
"active_days": { | |||
"description": "活跃多少天", | |||
"type": "string" | |||
}, | |||
"finish_count": { | |||
"description": "多少天内完成的指标", | |||
"type": "string" | |||
@@ -14369,6 +14465,9 @@ const docTemplate = `{ | |||
"model.UserLevelTask": { | |||
"type": "object", | |||
"properties": { | |||
"active_days": { | |||
"type": "integer" | |||
}, | |||
"create_at": { | |||
"type": "string" | |||
}, | |||
@@ -14397,6 +14496,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": { | |||
@@ -6957,6 +6957,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": "分类列表", | |||
@@ -8153,6 +8238,10 @@ | |||
"md.AddLevelTaskReq": { | |||
"type": "object", | |||
"properties": { | |||
"active_days": { | |||
"description": "活跃多少天", | |||
"type": "string" | |||
}, | |||
"finish_count": { | |||
"description": "多少天内完成的指标", | |||
"type": "string" | |||
@@ -11820,7 +11909,10 @@ | |||
"type": "string" | |||
}, | |||
"level": { | |||
"type": "string" | |||
"type": "array", | |||
"items": { | |||
"type": "string" | |||
} | |||
}, | |||
"platform": { | |||
"type": "string" | |||
@@ -12792,6 +12884,10 @@ | |||
"md.UpdateLevelTaskReq": { | |||
"type": "object", | |||
"properties": { | |||
"active_days": { | |||
"description": "活跃多少天", | |||
"type": "string" | |||
}, | |||
"finish_count": { | |||
"description": "多少天内完成的指标", | |||
"type": "string" | |||
@@ -14362,6 +14458,9 @@ | |||
"model.UserLevelTask": { | |||
"type": "object", | |||
"properties": { | |||
"active_days": { | |||
"type": "integer" | |||
}, | |||
"create_at": { | |||
"type": "string" | |||
}, | |||
@@ -14390,6 +14489,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": { | |||
@@ -451,6 +451,9 @@ definitions: | |||
type: object | |||
md.AddLevelTaskReq: | |||
properties: | |||
active_days: | |||
description: 活跃多少天 | |||
type: string | |||
finish_count: | |||
description: 多少天内完成的指标 | |||
type: string | |||
@@ -2990,7 +2993,9 @@ definitions: | |||
id: | |||
type: string | |||
level: | |||
type: string | |||
items: | |||
type: string | |||
type: array | |||
platform: | |||
type: string | |||
send_end_time: | |||
@@ -3664,6 +3669,9 @@ definitions: | |||
type: object | |||
md.UpdateLevelTaskReq: | |||
properties: | |||
active_days: | |||
description: 活跃多少天 | |||
type: string | |||
finish_count: | |||
description: 多少天内完成的指标 | |||
type: string | |||
@@ -4753,6 +4761,8 @@ definitions: | |||
type: object | |||
model.UserLevelTask: | |||
properties: | |||
active_days: | |||
type: integer | |||
create_at: | |||
type: string | |||
finish_count: | |||
@@ -4772,6 +4782,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: | |||
@@ -9371,6 +9403,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: | |||
@@ -33,7 +33,7 @@ require ( | |||
) | |||
require ( | |||
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241205092551-36f699384da5 | |||
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241206025738-447986c9608b | |||
code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241205075006-9c0bf995c788 | |||
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 | |||