gamelife 自定义客户端集成游戏任务接口
This commit is contained in:
@ -231,7 +231,7 @@ func (s *sTask) GetLoginTaskList(ctx context.Context, in *model.GetLoginTaskList
|
||||
|
||||
func (s *sTask) GetTaskList(ctx context.Context, in *model.TaskListIn) (out *model.TaskListOut, err error) {
|
||||
|
||||
var data []model.Tasks
|
||||
var data []model.Task
|
||||
var total int
|
||||
m := dao.Tasks.Ctx(ctx)
|
||||
|
||||
@ -239,11 +239,19 @@ func (s *sTask) GetTaskList(ctx context.Context, in *model.TaskListIn) (out *mod
|
||||
m = m.Where(do.Tasks{StoreId: in.StoreId})
|
||||
}
|
||||
|
||||
err = m.Page(in.Page, in.Size).Where(do.Tasks{GameId: in.Gid}).WithAll().ScanAndCount(&data, &total, false)
|
||||
|
||||
err = m.Page(in.Page, in.Size).Where(do.Tasks{GameId: in.Gid}).ScanAndCount(&data, &total, false)
|
||||
if err != nil {
|
||||
return nil, ecode.Fail.Sub("任务列表获取失败")
|
||||
}
|
||||
|
||||
for i, v := range data {
|
||||
if err = dao.StoreTaskRewards.Ctx(ctx).Where(do.StoreTaskRewards{TaskId: v.Id, StoreId: in.StoreId}).LeftJoin(
|
||||
dao.Rewards.Table(),
|
||||
fmt.Sprintf("%s.%s = %s.%s", dao.Rewards.Table(), dao.Rewards.Columns().Id, dao.StoreTaskRewards.Table(), dao.StoreTaskRewards.Columns().RewardId),
|
||||
).Fields(fmt.Sprintf("%s.*", dao.Rewards.Table())).Scan(&data[i].NetbarRewards); err != nil {
|
||||
return nil, ecode.Fail.Sub("任务奖励获取失败")
|
||||
}
|
||||
}
|
||||
return &model.TaskListOut{
|
||||
List: data,
|
||||
Total: total,
|
||||
|
||||
Reference in New Issue
Block a user