Merge remote-tracking branch 'origin/master'

This commit is contained in:
chy
2025-07-09 14:33:49 +08:00
2 changed files with 12 additions and 1 deletions

View File

@ -451,12 +451,23 @@ func (s *sTask) GetUserTaskRecordsList(ctx context.Context, in *model.UserTaskRe
if err != nil {
return nil, err
}
if value.IsEmpty() {
return nil, ecode.Params.Sub("网吧账号不存在")
}
orm = orm.Where(dao.UserTasks.Columns().StoreId, value.Int())
}
if in.GameId != 0 {
orm = orm.Where(dao.UserTasks.Columns().GameId, in.GameId)
}
switch in.TimeType {
case 1:
orm = orm.WhereGTE(dao.UserTasks.Columns().CreatedAt, gtime.Now().AddDate(0, 0, -7))
case 2:
orm = orm.WhereGTE(dao.UserTasks.Columns().CreatedAt, gtime.Now().AddDate(0, 0, -30))
case 3:
orm = orm.WhereGTE(dao.UserTasks.Columns().CreatedAt, gtime.Now().AddDate(0, 0, -365))
}
err = orm.Page(in.Page, in.Size).LeftJoin(dao.UserTaskRewards.Table(), fmt.Sprintf("`%s`.`user_task_id` = `%s`.`id`", dao.UserTaskRewards.Table(), dao.UserTasks.Table())).
Fields("user_tasks.*, group_concat(user_task_rewards.reward_name SEPARATOR ',') AS reward_name").Group("user_tasks.id").ScanAndCount(&list, &total, false)