From 86511ae2c82d778812ea0cddc4efc08f0712dd07 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期三, 27 九月 2023 16:41:30 +0800
Subject: [PATCH] fix
---
service/task.go | 12 +++++++-----
api/v1/task.go | 1 +
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/api/v1/task.go b/api/v1/task.go
index a03a4f0..419316b 100644
--- a/api/v1/task.go
+++ b/api/v1/task.go
@@ -115,6 +115,7 @@
taskResponse.Prompt = conf.Conf.Prompt
taskResponse.ChannelAmount = channelAmount
+ taskResponse.TaskCount = service.NewTaskService().NewTaskCount()
ctx.OkWithDetailed(taskResponse)
}
diff --git a/service/task.go b/service/task.go
index d24b996..446ae6d 100644
--- a/service/task.go
+++ b/service/task.go
@@ -106,15 +106,17 @@
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)
--
Gitblit v1.8.0