兼容无token下拉取任务列表

This commit is contained in:
lianghuanjie
2024-12-18 15:41:05 +08:00
parent b93614f0df
commit 391a9d3481
6 changed files with 55 additions and 46 deletions

View File

@@ -28,8 +28,8 @@ func NewGetTaskListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetTa
}
}
func (l *GetTaskListLogic) GetTaskList(req *types.GetTaskListReq) (*types.GetTaskListResp, error) {
uid := cast.ToStringMapInt(l.ctx.Value("data"))["id"]
func (l *GetTaskListLogic) GetTaskList(uid int, req *types.GetTaskListReq) (*types.GetTaskListResp, error) {
//uid := cast.ToStringMapInt(l.ctx.Value("data"))["id"]
tasks, err := l.svcCtx.TaskModel.FindTasksByCommunity(l.ctx, req.CommunityId)
if err != nil {
l.Errorw("get task list failed", logx.Field("err", err), logx.Field("communityId", req.CommunityId))
@@ -43,10 +43,13 @@ func (l *GetTaskListLogic) GetTaskList(req *types.GetTaskListReq) (*types.GetTas
taskSeq = cast.ToInt(time.Now().Format("20060102"))
}
var finishState int8
tp, err := l.svcCtx.TaskProgressModel.FindOneByUidTaskIdTaskSeq(l.ctx, uid, t.CommunityId, taskSeq)
if err == nil {
finishState = tp.Stage
if uid > 0 {
tp, err := l.svcCtx.TaskProgressModel.FindOneByUidTaskIdTaskSeq(l.ctx, uid, t.CommunityId, taskSeq)
if err == nil {
finishState = tp.Stage
}
}
resp.Tasks = append(resp.Tasks, types.Task{
Id: t.Id,
Title: t.Title,