Browse Source

定时修改任务状态接口

Former-commit-id: 6d99429548
pull/9/head
zhangwei 2 years ago
parent
commit
5aabbbdf2a
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      rpc/internal/cron/cronlogic.go

+ 1
- 1
rpc/internal/cron/cronlogic.go View File

@@ -14,7 +14,7 @@ func InitCron(svc *svc.ServiceContext) {
svc.Cron.AddFunc("*/5 * * * * ?", func() { svc.Cron.AddFunc("*/5 * * * * ?", func() {


var tasks []models.Task var tasks []models.Task
svc.DbEngin.Not("status not in ?", []string{constants.Deleted, constants.Succeeded, constants.Completed, constants.Failed}).Find(&tasks)
svc.DbEngin.Where("status not in ?", []string{constants.Deleted, constants.Succeeded, constants.Completed, constants.Failed}).Find(&tasks)
for _, task := range tasks { for _, task := range tasks {
var allStatus string var allStatus string
tx := svc.DbEngin.Raw("SELECT CONCAT_WS(',',GROUP_CONCAT(DISTINCT h.status) ,GROUP_CONCAT(DISTINCT a.status) ,GROUP_CONCAT(DISTINCT c.status))as status from task t left join hpc h on t.id = h.task_id left join cloud c on t.id = c.task_id left join ai a on t.id = a.task_id where t.id = ?", task.Id).Scan(&allStatus) tx := svc.DbEngin.Raw("SELECT CONCAT_WS(',',GROUP_CONCAT(DISTINCT h.status) ,GROUP_CONCAT(DISTINCT a.status) ,GROUP_CONCAT(DISTINCT c.status))as status from task t left join hpc h on t.id = h.task_id left join cloud c on t.id = c.task_id left join ai a on t.id = a.task_id where t.id = ?", task.Id).Scan(&allStatus)


Loading…
Cancel
Save