task.go 554 B

12345678910111213141516171819202122232425262728
  1. package service
  2. import (
  3. "context"
  4. "go-common/app/admin/ep/saga/model"
  5. )
  6. // MergeTasks query all tasks for the project.
  7. func (s *Service) MergeTasks(c context.Context, req *model.TasksReq) (resp *model.TasksResp, err error) {
  8. var (
  9. tasks []*model.Task
  10. status int
  11. )
  12. resp = new(model.TasksResp)
  13. if _, err = s.dao.ProjectInfoByID(req.ProjID); err != nil {
  14. return
  15. }
  16. for _, status = range req.Statuses {
  17. if tasks, err = s.dao.Tasks(req.ProjID, status); err != nil {
  18. return
  19. }
  20. resp.Tasks = append(resp.Tasks, tasks...)
  21. }
  22. return
  23. }