go-common/app/admin/ep/saga/service/task.go

29 lines
554 B
Go
Raw Normal View History

2019-04-22 10:49:16 +00:00
package service
import (
"context"
"go-common/app/admin/ep/saga/model"
)
// MergeTasks query all tasks for the project.
func (s *Service) MergeTasks(c context.Context, req *model.TasksReq) (resp *model.TasksResp, err error) {
var (
tasks []*model.Task
status int
)
resp = new(model.TasksResp)
if _, err = s.dao.ProjectInfoByID(req.ProjID); err != nil {
return
}
for _, status = range req.Statuses {
if tasks, err = s.dao.Tasks(req.ProjID, status); err != nil {
return
}
resp.Tasks = append(resp.Tasks, tasks...)
}
return
}