Commit f47323ac authored by 贾浩@五瓣科技's avatar 贾浩@五瓣科技

add pass resap

parent b1097bf5
......@@ -61,6 +61,7 @@ type Task struct {
Enable bool `json:"enable"`
Msg string `json:"msg"`
SubmitTimestamp int `json:"submitTimestamp"`
Pass bool `json:"pass"`
}
type CreateTaskRequest struct {
......
......@@ -62,6 +62,7 @@ func (s *Service) GetGroup(gid int, userId string, admin bool) (resp *apiModel.G
taskResults := make([]apiModel.Task, len(tasks))
var wg sync.WaitGroup
var errCh = make(chan error, len(tasks))
for i := range tasks {
wg.Add(1)
......@@ -80,11 +81,13 @@ func (s *Service) GetGroup(gid int, userId string, admin bool) (resp *apiModel.G
Daily: task.Daily,
TweetId: task.TweetId,
Enable: task.Enable,
Pass: task.Pass,
}
status, submittedAt, err := s.GetTaskResult(_task.Daily, _task.TaskId.(int), userId)
if err != nil {
log.WithError(err).Error("group check task")
errCh <- err
return
}
_task.Status = status
......@@ -97,6 +100,12 @@ func (s *Service) GetGroup(gid int, userId string, admin bool) (resp *apiModel.G
}
wg.Wait()
if len(errCh) > 0 {
err = <-errCh
close(errCh)
return
}
resp.Tasks = taskResults
return
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment