修改查询已完成任务列表

This commit is contained in:
chy
2025-07-05 15:13:06 +08:00
parent 8792c4d3db
commit 83df840c84
2 changed files with 32 additions and 2 deletions

View File

@ -296,7 +296,8 @@ func (s *sTask) GetLoginTaskList(ctx context.Context, in *model.GetTaskListIn) (
func (s *sTask) GetTaskCompletedList(ctx context.Context, in *model.TaskListIn) (out *model.TaskListOut, err error) {
m := dao.UserTasks.Ctx(ctx)
var data []model.UserTask
//var data []model.UserTask
var data []model.UserTaskRecord
var total int
if in.StoreId > 0 {
m = m.Where(dao.UserTasks.Columns().StoreId, in.StoreId)
@ -307,7 +308,7 @@ func (s *sTask) GetTaskCompletedList(ctx context.Context, in *model.TaskListIn)
// LeftJoin(dao.Stores.Table(), fmt.Sprintf("`%s`.`id` = `%s`.`store_id`", dao.Stores.Table(), dao.UserTasks.Table())).
// LeftJoin(dao.Games.Table(), fmt.Sprintf("`%s`.`game_id` = `%s`.`game_id`", dao.Games.Table(), dao.UserTasks.Table())).WithAll().ScanAndCount(&data, &total, false)
err = m.Page(in.Page, in.Size).WithAll().ScanAndCount(&data, &total, false)
err = m.Page(in.Page, in.Size).Where(dao.UserTasks.Columns().Status, 2).WithAll().ScanAndCount(&data, &total, false)
if err != nil {
return nil, ecode.Fail.Sub("获取已完成任务列表失败")

View File

@ -48,6 +48,35 @@ type UserTask2 struct {
//TaskRewards []TaskReward `json:"taskRewards" orm:"with:task_id=task_id"`
}
type UserTaskRecord struct {
g.Meta `orm:"table:task"`
Id int64 `json:"id" orm:"id" description:"用户任务唯一标识符"` // 用户任务唯一标识符
UserId int64 `json:"userId" orm:"user_id" description:"用户ID"` // 用户ID
TaskId string `json:"taskId" orm:"task_id" description:"腾讯任务ID"` // 腾讯任务ID
//Status int `json:"status" orm:"status" description:"任务状态1=进行中2=已完成中3=未完成"` // 任务状态1=进行中(显示领取按钮)2=已完成
//StoreId int64 `json:"storeId" orm:"store_id" description:"门店 id"` // 门店 id
TaskName string `json:"taskName" orm:"task_name" description:"任务名称"` // 任务名称
GameId int64 `json:"gameId" orm:"game_id" description:"游戏 id"` // 游戏 id
User UserInfo `json:"user,omitempty" orm:"with:id=user_id"`
Game GameInfo `json:"game,omitempty" orm:"with:game_id=game_id"`
// Store Store `json:"store" orm:"with:id=store_id"`
}
type UserInfo struct {
g.Meta `orm:"table:users"`
Id int64 `json:"id" orm:"id,primary"` // 用户ID
Username string `json:"username" orm:"username,not null"` // 用户名
Nickname string `json:"nickname" orm:"nickname"` // 昵称
}
type GameInfo struct {
g.Meta `orm:"table:games"`
GameId int64 `json:"gameId" orm:"game_id"` // 腾讯游戏 id
GameName string `json:"gameName" orm:"game_name"` // 游戏名称
GameCode string `json:"gameCode" orm:"game_code"` // 游戏代号
Id int64 `json:"id" orm:"id"`
}
// UserTaskRankingIn 任务排行榜入参
type UserTaskRankingIn struct {
Page int