| | |
| | | taskList = append(taskList, &taskData) |
| | | workers = append(workers, procedure.ProceduresInfo.Workers...) |
| | | } |
| | | |
| | | count, _ = model.NewProceduresSearch(nil).SetDeviceId(conf.Conf.System.DeviceId).SetStatus(model.ProcedureStatusWaitProcess).SetStartTimeMax(nowTs).SetEndTimeMin(nowTs).Count() |
| | | taskResp = &response.TaskResponse{ |
| | | Tasks: taskList, |
| | | TaskCount: count, |
| | | Workers: slf.WorkerDistinct(workers), |
| | | Tasks: taskList, |
| | | Workers: slf.WorkerDistinct(workers), |
| | | } |
| | | return taskResp, ecode.OK |
| | | } |
| | | func (slf TaskService) NewTaskCount() (count int64) { |
| | | nowTs := time.Now().Unix() |
| | | count, _ = model.NewProceduresSearch(nil).SetDeviceId(conf.Conf.System.DeviceId).SetStatus(model.ProcedureStatusWaitProcess).SetStartTimeMax(nowTs).SetEndTimeMin(nowTs).Count() |
| | | return count |
| | | } |
| | | |
| | | func (slf TaskService) WorkerDistinct(workers []*common.ProcedureWorker) (NoRepeatedWorkers []*common.ProcedureWorker) { |
| | | exists := make(map[string]bool, 0) |