diff --git a/app/hdl/member_center/hdl_level__management.go b/app/hdl/member_center/hdl_level__management.go index 715ee23..477fd72 100644 --- a/app/hdl/member_center/hdl_level__management.go +++ b/app/hdl/member_center/hdl_level__management.go @@ -4,6 +4,7 @@ import ( "applet/app/db" "applet/app/e" md2 "applet/app/md/member_center" + svc "applet/app/svc/member_center" "applet/app/utils" "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" "code.fnuoos.com/EggPlanet/egg_models.git/src/model" @@ -135,107 +136,6 @@ func GetOneLevel(c *gin.Context) { e.OutSuc(c, resp, nil) } -// AddLevelTask -// @Summary 制度中心-会员中心-等级明细-等级任务(新增) -// @Tags 会员中心 -// @Description 等级任务(新增) -// @Accept json -// @Produce json -// @param Authorization header string true "验证参数Bearer和token空格拼接" -// @Param req body md.AddLevelTaskReq true "需要新增的任务信息" -// @Success 200 {int} "新增的任务ID" -// @Failure 400 {object} md.Response "具体错误" -// @Router /api/memberCenter/levelManagement/addLevelTask [post] -func AddLevelTask(c *gin.Context) { - var req *md2.AddLevelTaskReq - if err := c.ShouldBindJSON(&req); err != nil { - e.OutErr(c, e.ERR_INVALID_ARGS, err.Error()) - return - } - - task := model.UserLevelTask{ - Id: 0, - LevelId: utils.StrToInt(req.LevelID), - CreateAt: time.Now().Format("2006-01-02 15:04:05"), - } - if req.IsMustTask != "" { - task.IsMustTask = utils.StrToInt(req.IsMustTask) - } - if req.TaskType != "" { - task.TaskType = utils.StrToInt(req.TaskType) - } - if req.WithinDays != "" { - task.WithinDays = utils.StrToInt(req.WithinDays) - } - if req.FinishCount != "" { - task.FinishCount = utils.StrToInt(req.FinishCount) - } - 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) - if err != nil { - e.OutErr(c, e.ERR_DB_ORM, err.Error()) - return - } - e.OutSuc(c, taskID, nil) -} - -// UpdateLevelTask -// @Summary 制度中心-会员中心-等级明细-等级任务(更新) -// @Tags 会员中心 -// @Description 等级任务(更新) -// @Accept json -// @Produce json -// @param Authorization header string true "验证参数Bearer和token空格拼接" -// @Param req body md.UpdateLevelTaskReq true "需要修改的等级任务信息" -// @Success 200 {int} "成功修改数据条数" -// @Failure 400 {object} md.Response "具体错误" -// @Router /api/memberCenter/levelManagement/updateLevelTask [post] -func UpdateLevelTask(c *gin.Context) { - var req *md2.UpdateLevelTaskReq - if err := c.ShouldBindJSON(&req); err != nil { - 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) - } - if req.WithinDays != "" { - task.WithinDays = utils.StrToInt(req.WithinDays) - } - if req.FinishCount != "" { - task.FinishCount = utils.StrToInt(req.FinishCount) - } - 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, forceColumns...) - if err != nil { - e.OutErr(c, e.ERR_DB_ORM, err.Error()) - return - } - e.OutSuc(c, affected, nil) -} - // UpdateLevel // @Summary 制度中心-会员中心-等级管理(更新) // @Tags 会员中心 @@ -244,7 +144,7 @@ func UpdateLevelTask(c *gin.Context) { // @Produce json // @param Authorization header string true "验证参数Bearer和token空格拼接" // @Param req body md.UpdateLevelReq true "需要修改的等级信息" -// @Success 200 {int} "成功修改数据条数" +// @Success 200 {string} "success" // @Failure 400 {object} md.Response "具体错误" // @Router /api/memberCenter/levelManagement/updateLevel [post] func UpdateLevel(c *gin.Context) { @@ -273,8 +173,12 @@ func UpdateLevel(c *gin.Context) { forceColumns = append(forceColumns, "auto_update") } + session := db.Db.NewSession() + defer session.Close() + + // 1. 更新等级信息 levelDb := implement.NewUserLevelDb(db.Db) - affected, err := levelDb.UserLevelUpdate(req.LevelID, level, forceColumns...) + affected, err := levelDb.UserLevelUpdateBySession(session, req.LevelID, level, forceColumns...) if err != nil { if err.Error() == "no columns found to be updated" { e.OutSuc(c, affected, nil) @@ -284,7 +188,32 @@ func UpdateLevel(c *gin.Context) { return } - e.OutSuc(c, affected, nil) + // 2. 更新任务信息 + // 2.1 删除关联任务 + taskDb := implement.NewUserLevelTaskDb(db.Db) + _, err = taskDb.UserLevelTaskDeleteByParamsBySession(session, map[string]interface{}{ + "key": "level_id", + "value": req.LevelID, + }) + if err != nil { + e.OutErr(c, e.ERR_DB_ORM, err.Error()) + return + } + + // 2.2 添加更新后的任务 + err = svc.BatchAddLevelTask(session, req.UserLevelTasks, utils.StrToInt(req.LevelID)) + if err != nil { + e.OutErr(c, e.ERR_DB_ORM, err.Error()) + return + } + + err = session.Commit() + if err != nil { + session.Rollback() + e.OutErr(c, e.ERR_DB_ORM, nil) + return + } + e.OutSuc(c, "success", nil) } // AddLevel @@ -321,12 +250,30 @@ func AddLevel(c *gin.Context) { level.AutoUpdate = utils.StrToInt(req.AutoUpdate) } + session := db.Db.NewSession() + defer session.Close() + + // 1. 创建等级信息 levelDb := implement.NewUserLevelDb(db.Db) - id, err := levelDb.UserLevelInsert(level) + id, err := levelDb.UserLevelInsertBySession(session, level) + if err != nil { + e.OutErr(c, e.ERR_DB_ORM, err.Error()) + return + } + + // 2. 创建任务信息 + err = svc.BatchAddLevelTask(session, req.UserLevelTasks, id) if err != nil { e.OutErr(c, e.ERR_DB_ORM, err.Error()) return } + + err = session.Commit() + if err != nil { + session.Rollback() + e.OutErr(c, e.ERR_DB_ORM, err.Error()) + return + } e.OutSuc(c, id, nil) } @@ -349,7 +296,12 @@ func DeleteLevelTask(c *gin.Context) { } taskDb := implement.NewUserLevelTaskDb(db.Db) - affected, err := taskDb.UserLevelTaskDelete(req.TaskID) + session := db.Db.Where("") + // 不需要使用事务 + affected, err := taskDb.UserLevelTaskDeleteByParamsBySession(session, map[string]interface{}{ + "key": "id", + "value": req.TaskID, + }) if err != nil { e.OutErr(c, e.ERR_DB_ORM, err.Error()) return @@ -375,6 +327,20 @@ func DeleteLevel(c *gin.Context) { return } + userDb := implement.NewUserDb(db.Db) + exist, err := userDb.UserExistByParams(map[string]interface{}{ + "key": "level", + "value": req.LevelID, + }) + if err != nil { + e.OutErr(c, e.ERR_DB_ORM, err.Error()) + return + } + if !exist { + e.OutErr(c, e.ERR, errors.New("该等级下存在会员,无法删除,请移除对应等级下会员或将货源移动到其他等级").Error()) + return + } + session := db.Db.NewSession() defer session.Close() session.Begin() @@ -384,13 +350,20 @@ func DeleteLevel(c *gin.Context) { e.OutErr(c, e.ERR_DB_ORM, err.Error()) return } - - sql := "UPDATE `user` SET level = 0 WHERE level = ?" - _, err = session.QueryString(sql, req.LevelID) + taskDb := implement.NewUserLevelTaskDb(db.Db) + taskAffected, err := taskDb.UserLevelTaskDeleteByParamsBySession(session, map[string]interface{}{ + "key": "level_id", + "value": req.LevelID, + }) + if err != nil { + return + } + err = session.Commit() if err != nil { + session.Rollback() e.OutErr(c, e.ERR_DB_ORM, err.Error()) return } - session.Commit() + affected += taskAffected e.OutSuc(c, affected, nil) } diff --git a/app/md/member_center/md_level_management.go b/app/md/member_center/md_level_management.go index 272090d..68ddf71 100644 --- a/app/md/member_center/md_level_management.go +++ b/app/md/member_center/md_level_management.go @@ -29,37 +29,28 @@ type GetOneLevelResp struct { UserLevelTasks []model.UserLevelTask `json:"user_level_tasks"` } -type AddLevelTaskReq struct { - LevelID string `json:"level_id"` // 等级 ID - IsMustTask string `json:"is_must_task"` // 是否必做(0,1) - 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时生效) -} - type UpdateLevelReq struct { - LevelID string `json:"level_id"` - IsUse string `json:"is_use"` // 是否开启(0.否, 1.是) - AutoUpdate string `json:"auto_update"` // 自动升级 0关闭 1开启 - LevelName string `json:"level_name"` // 等级名称 - Memo string `json:"memo"` // 备注 - LevelWeight string `json:"level_weight"` // 等级权重 - ChoosableNum string `json:"choosable_num"` // 可选任务数量 + LevelID string `json:"level_id"` + IsUse string `json:"is_use"` // 是否开启(0.否, 1.是) + AutoUpdate string `json:"auto_update"` // 自动升级 0关闭 1开启 + LevelName string `json:"level_name"` // 等级名称 + Memo string `json:"memo"` // 备注 + LevelWeight string `json:"level_weight"` // 等级权重 + ChoosableNum string `json:"choosable_num"` // 可选任务数量 + UserLevelTasks []LevelTaskNode `json:"user_level_tasks"` // 完整的任务列表 } type AddLevelReq struct { - IsUse string `json:"is_use"` // 是否开启(0.否, 1.是) - AutoUpdate string `json:"auto_update"` // 自动升级 0关闭 1开启 - LevelName string `json:"level_name"` // 等级名称 - Memo string `json:"memo"` // 备注 - LevelWeight string `json:"level_weight"` // 等级权重 - ChoosableNum string `json:"choosable_num"` // 可选任务数量 + IsUse string `json:"is_use"` // 是否开启(0.否, 1.是) + AutoUpdate string `json:"auto_update"` // 自动升级 0关闭 1开启 + LevelName string `json:"level_name"` // 等级名称 + Memo string `json:"memo"` // 备注 + LevelWeight string `json:"level_weight"` // 等级权重 + ChoosableNum string `json:"choosable_num"` // 可选任务数量 + UserLevelTasks []LevelTaskNode `json:"user_level_tasks"` // 需要新增的任务 } -type UpdateLevelTaskReq struct { - TaskID string `json:"task_id,required"` // 等级 ID +type LevelTaskNode struct { IsMustTask string `json:"is_must_task"` // 是否必做(0,1) TaskType string `json:"task_type"` // 1:直推会员人数,2:直推会员活跃天数,3:直推会员等级 WithinDays string `json:"within_days"` // 多少天内完成 diff --git a/app/router/router.go b/app/router/router.go index f0aeb71..8254886 100644 --- a/app/router/router.go +++ b/app/router/router.go @@ -338,8 +338,6 @@ func rMemberCenter(r *gin.RouterGroup) { // 会员中心 rLevelManagement.POST("/updateLevel", member_center.UpdateLevel) rLevelManagement.POST("/addLevel", member_center.AddLevel) rLevelManagement.DELETE("/deleteLevel", member_center.DeleteLevel) - rLevelManagement.POST("/addLevelTask", member_center.AddLevelTask) - rLevelManagement.POST("/updateLevelTask", member_center.UpdateLevelTask) rLevelManagement.DELETE("/deleteLevelTask", member_center.DeleteLevelTask) } } diff --git a/app/svc/member_center/svc_level_management.go b/app/svc/member_center/svc_level_management.go new file mode 100644 index 0000000..4a19be4 --- /dev/null +++ b/app/svc/member_center/svc_level_management.go @@ -0,0 +1,47 @@ +package svc + +import ( + "applet/app/db" + md "applet/app/md/member_center" + "applet/app/utils" + "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" + "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + "time" + "xorm.io/xorm" +) + +func BatchAddLevelTask(session *xorm.Session, tasks []md.LevelTaskNode, levelId int) (err error) { + nowStr := time.Now().Format("2006-01-02 15:04:05") + m := make([]model.UserLevelTask, len(tasks)) + for i, task := range tasks { + m[i].LevelId = levelId + m[i].CreateAt = nowStr + m[i].UpdateAt = nowStr + if task.IsMustTask != "" { + m[i].IsMustTask = utils.StrToInt(task.IsMustTask) + } + if task.TaskType != "" { + m[i].TaskType = utils.StrToInt(task.TaskType) + } + if task.WithinDays != "" { + m[i].WithinDays = utils.StrToInt(task.WithinDays) + } + if task.FinishCount != "" { + m[i].FinishCount = utils.StrToInt(task.FinishCount) + } + if task.TaskTypeLevelId != "" { + m[i].TaskTypeLevelId = utils.StrToInt(task.TaskTypeLevelId) + } + if task.ActiveDays != "" { + m[i].ActiveDays = utils.StrToInt(task.ActiveDays) + } + } + + taskDb := implement.NewUserLevelTaskDb(db.Db) + _, err = taskDb.UserLevelTaskBatchInsertBySession(session, m) + if err != nil { + return err + } + return nil + +} diff --git a/docs/docs.go b/docs/docs.go index 52f4676..5763c84 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1,5 +1,4 @@ -// Code generated by swaggo/swag. DO NOT EDIT. - +// Package docs Code generated by swaggo/swag. DO NOT EDIT package docs import "github.com/swaggo/swag" @@ -1438,9 +1437,7 @@ const docTemplate = `{ "name": "req", "in": "body", "required": true, - "schema": { - "type": "object" - } + "schema": {} } ], "responses": { @@ -5568,53 +5565,6 @@ const docTemplate = `{ } } }, - "/api/memberCenter/levelManagement/addLevelTask": { - "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/md.AddLevelTaskReq" - } - } - ], - "responses": { - "200": { - "description": "新增的任务ID", - "schema": { - "type": "int" - } - }, - "400": { - "description": "具体错误", - "schema": { - "$ref": "#/definitions/md.Response" - } - } - } - } - }, "/api/memberCenter/levelManagement/deleteLevel": { "delete": { "description": "等级管理(删除)", @@ -5839,56 +5789,9 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "成功修改数据条数", - "schema": { - "type": "int" - } - }, - "400": { - "description": "具体错误", - "schema": { - "$ref": "#/definitions/md.Response" - } - } - } - } - }, - "/api/memberCenter/levelManagement/updateLevelTask": { - "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/md.UpdateLevelTaskReq" - } - } - ], - "responses": { - "200": { - "description": "成功修改数据条数", + "description": "success", "schema": { - "type": "int" + "type": "string" } }, "400": { @@ -8242,39 +8145,13 @@ const docTemplate = `{ "memo": { "description": "备注", "type": "string" - } - } - }, - "md.AddLevelTaskReq": { - "type": "object", - "properties": { - "active_days": { - "description": "活跃多少天", - "type": "string" - }, - "finish_count": { - "description": "多少天内完成的指标", - "type": "string" - }, - "is_must_task": { - "description": "是否必做(0,1)", - "type": "string" - }, - "level_id": { - "description": "等级 ID", - "type": "string" - }, - "task_type": { - "description": "1:直推会员人数,2:直推会员活跃天数,3:直推会员等级", - "type": "string" - }, - "task_type_level_id": { - "description": "会员等级 ID (task_type=3时生效)", - "type": "string" }, - "within_days": { - "description": "多少天内完成", - "type": "string" + "user_level_tasks": { + "description": "需要新增的任务", + "type": "array", + "items": { + "$ref": "#/definitions/md.LevelTaskNode" + } } } }, @@ -11183,6 +11060,35 @@ const docTemplate = `{ } } }, + "md.LevelTaskNode": { + "type": "object", + "properties": { + "active_days": { + "description": "活跃多少天", + "type": "string" + }, + "finish_count": { + "description": "多少天内完成的指标", + "type": "string" + }, + "is_must_task": { + "description": "是否必做(0,1)", + "type": "string" + }, + "task_type": { + "description": "1:直推会员人数,2:直推会员活跃天数,3:直推会员等级", + "type": "string" + }, + "task_type_level_id": { + "description": "会员等级 ID (task_type=3时生效)", + "type": "string" + }, + "within_days": { + "description": "多少天内完成", + "type": "string" + } + } + }, "md.ListCommunityDividendsReq": { "type": "object", "properties": { @@ -12888,39 +12794,13 @@ const docTemplate = `{ "memo": { "description": "备注", "type": "string" - } - } - }, - "md.UpdateLevelTaskReq": { - "type": "object", - "properties": { - "active_days": { - "description": "活跃多少天", - "type": "string" - }, - "finish_count": { - "description": "多少天内完成的指标", - "type": "string" }, - "is_must_task": { - "description": "是否必做(0,1)", - "type": "string" - }, - "task_id": { - "description": "等级 ID", - "type": "string" - }, - "task_type": { - "description": "1:直推会员人数,2:直推会员活跃天数,3:直推会员等级", - "type": "string" - }, - "task_type_level_id": { - "description": "会员等级 ID (task_type=3时生效)", - "type": "string" - }, - "within_days": { - "description": "多少天内完成", - "type": "string" + "user_level_tasks": { + "description": "完整的任务列表", + "type": "array", + "items": { + "$ref": "#/definitions/md.LevelTaskNode" + } } } }, @@ -14562,6 +14442,8 @@ var SwaggerInfo = &swag.Spec{ Description: "管理后台接口文档", InfoInstanceName: "swagger", SwaggerTemplate: docTemplate, + LeftDelim: "{{", + RightDelim: "}}", } func init() { diff --git a/docs/swagger.json b/docs/swagger.json index 95d56df..90e5017 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -1430,9 +1430,7 @@ "name": "req", "in": "body", "required": true, - "schema": { - "type": "object" - } + "schema": {} } ], "responses": { @@ -5560,53 +5558,6 @@ } } }, - "/api/memberCenter/levelManagement/addLevelTask": { - "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/md.AddLevelTaskReq" - } - } - ], - "responses": { - "200": { - "description": "新增的任务ID", - "schema": { - "type": "int" - } - }, - "400": { - "description": "具体错误", - "schema": { - "$ref": "#/definitions/md.Response" - } - } - } - } - }, "/api/memberCenter/levelManagement/deleteLevel": { "delete": { "description": "等级管理(删除)", @@ -5831,56 +5782,9 @@ ], "responses": { "200": { - "description": "成功修改数据条数", - "schema": { - "type": "int" - } - }, - "400": { - "description": "具体错误", - "schema": { - "$ref": "#/definitions/md.Response" - } - } - } - } - }, - "/api/memberCenter/levelManagement/updateLevelTask": { - "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/md.UpdateLevelTaskReq" - } - } - ], - "responses": { - "200": { - "description": "成功修改数据条数", + "description": "success", "schema": { - "type": "int" + "type": "string" } }, "400": { @@ -8234,39 +8138,13 @@ "memo": { "description": "备注", "type": "string" - } - } - }, - "md.AddLevelTaskReq": { - "type": "object", - "properties": { - "active_days": { - "description": "活跃多少天", - "type": "string" - }, - "finish_count": { - "description": "多少天内完成的指标", - "type": "string" - }, - "is_must_task": { - "description": "是否必做(0,1)", - "type": "string" - }, - "level_id": { - "description": "等级 ID", - "type": "string" - }, - "task_type": { - "description": "1:直推会员人数,2:直推会员活跃天数,3:直推会员等级", - "type": "string" - }, - "task_type_level_id": { - "description": "会员等级 ID (task_type=3时生效)", - "type": "string" }, - "within_days": { - "description": "多少天内完成", - "type": "string" + "user_level_tasks": { + "description": "需要新增的任务", + "type": "array", + "items": { + "$ref": "#/definitions/md.LevelTaskNode" + } } } }, @@ -11175,6 +11053,35 @@ } } }, + "md.LevelTaskNode": { + "type": "object", + "properties": { + "active_days": { + "description": "活跃多少天", + "type": "string" + }, + "finish_count": { + "description": "多少天内完成的指标", + "type": "string" + }, + "is_must_task": { + "description": "是否必做(0,1)", + "type": "string" + }, + "task_type": { + "description": "1:直推会员人数,2:直推会员活跃天数,3:直推会员等级", + "type": "string" + }, + "task_type_level_id": { + "description": "会员等级 ID (task_type=3时生效)", + "type": "string" + }, + "within_days": { + "description": "多少天内完成", + "type": "string" + } + } + }, "md.ListCommunityDividendsReq": { "type": "object", "properties": { @@ -12880,39 +12787,13 @@ "memo": { "description": "备注", "type": "string" - } - } - }, - "md.UpdateLevelTaskReq": { - "type": "object", - "properties": { - "active_days": { - "description": "活跃多少天", - "type": "string" - }, - "finish_count": { - "description": "多少天内完成的指标", - "type": "string" }, - "is_must_task": { - "description": "是否必做(0,1)", - "type": "string" - }, - "task_id": { - "description": "等级 ID", - "type": "string" - }, - "task_type": { - "description": "1:直推会员人数,2:直推会员活跃天数,3:直推会员等级", - "type": "string" - }, - "task_type_level_id": { - "description": "会员等级 ID (task_type=3时生效)", - "type": "string" - }, - "within_days": { - "description": "多少天内完成", - "type": "string" + "user_level_tasks": { + "description": "完整的任务列表", + "type": "array", + "items": { + "$ref": "#/definitions/md.LevelTaskNode" + } } } }, diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 0034204..ca1809b 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -448,30 +448,11 @@ definitions: memo: description: 备注 type: string - type: object - md.AddLevelTaskReq: - properties: - active_days: - description: 活跃多少天 - type: string - finish_count: - description: 多少天内完成的指标 - type: string - is_must_task: - description: 是否必做(0,1) - type: string - level_id: - description: 等级 ID - type: string - task_type: - description: 1:直推会员人数,2:直推会员活跃天数,3:直推会员等级 - type: string - task_type_level_id: - description: 会员等级 ID (task_type=3时生效) - type: string - within_days: - description: 多少天内完成 - type: string + user_level_tasks: + description: 需要新增的任务 + items: + $ref: '#/definitions/md.LevelTaskNode' + type: array type: object md.AddPlatformRevenueReq: properties: @@ -2476,6 +2457,27 @@ definitions: description: 备注 type: string type: object + md.LevelTaskNode: + properties: + active_days: + description: 活跃多少天 + type: string + finish_count: + description: 多少天内完成的指标 + type: string + is_must_task: + description: 是否必做(0,1) + type: string + task_type: + description: 1:直推会员人数,2:直推会员活跃天数,3:直推会员等级 + type: string + task_type_level_id: + description: 会员等级 ID (task_type=3时生效) + type: string + within_days: + description: 多少天内完成 + type: string + type: object md.ListCommunityDividendsReq: properties: end_at: @@ -3666,30 +3668,11 @@ definitions: memo: description: 备注 type: string - type: object - md.UpdateLevelTaskReq: - properties: - active_days: - description: 活跃多少天 - type: string - finish_count: - description: 多少天内完成的指标 - type: string - is_must_task: - description: 是否必做(0,1) - type: string - task_id: - description: 等级 ID - type: string - task_type: - description: 1:直推会员人数,2:直推会员活跃天数,3:直推会员等级 - type: string - task_type_level_id: - description: 会员等级 ID (task_type=3时生效) - type: string - within_days: - description: 多少天内完成 - type: string + user_level_tasks: + description: 完整的任务列表 + items: + $ref: '#/definitions/md.LevelTaskNode' + type: array type: object md.UpdatePublicPlatoonBasicReq: properties: @@ -5753,8 +5736,7 @@ paths: in: body name: req required: true - schema: - type: object + schema: {} produces: - application/json responses: @@ -8481,37 +8463,6 @@ paths: summary: 制度中心-会员中心-等级管理(新增) tags: - 会员中心 - /api/memberCenter/levelManagement/addLevelTask: - 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/md.AddLevelTaskReq' - produces: - - application/json - responses: - "200": - description: 新增的任务ID - schema: - type: int - "400": - description: 具体错误 - schema: - $ref: '#/definitions/md.Response' - summary: 制度中心-会员中心-等级明细-等级任务(新增) - tags: - - 会员中心 /api/memberCenter/levelManagement/deleteLevel: delete: consumes: @@ -8660,9 +8611,9 @@ paths: - application/json responses: "200": - description: 成功修改数据条数 + description: success schema: - type: int + type: string "400": description: 具体错误 schema: @@ -8670,37 +8621,6 @@ paths: summary: 制度中心-会员中心-等级管理(更新) tags: - 会员中心 - /api/memberCenter/levelManagement/updateLevelTask: - 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/md.UpdateLevelTaskReq' - produces: - - application/json - responses: - "200": - description: 成功修改数据条数 - schema: - type: int - "400": - description: 具体错误 - schema: - $ref: '#/definitions/md.Response' - summary: 制度中心-会员中心-等级明细-等级任务(更新) - tags: - - 会员中心 /api/memberCenter/tagManagement/addTag: post: consumes: diff --git a/go.mod b/go.mod index 57dcb2e..3e932e9 100644 --- a/go.mod +++ b/go.mod @@ -33,7 +33,7 @@ require ( ) require ( - code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241206025738-447986c9608b + code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241206061858-d583849c70ea 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