瀏覽代碼

update

master
shenjiachi 1 周之前
父節點
當前提交
ef721d6621
共有 3 個文件被更改,包括 21 次插入5 次删除
  1. +18
    -4
      app/hdl/member_center/hdl_level__management.go
  2. +2
    -0
      app/md/member_center/md_level_management.go
  3. +1
    -1
      go.mod

+ 18
- 4
app/hdl/member_center/hdl_level__management.go 查看文件

@@ -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
}


+ 2
- 0
app/md/member_center/md_level_management.go 查看文件

@@ -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时生效)
}



+ 1
- 1
go.mod 查看文件

@@ -33,7 +33,7 @@ require (
)

require (
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241205122147-7bfed5d258c7
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


Loading…
取消
儲存