From df0db4b84391e67da2363589471082c2bc07bc34 Mon Sep 17 00:00:00 2001 From: ouqiang Date: Tue, 23 May 2017 15:42:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BB=B6=E6=97=B6=E4=BB=BB=E5=8A=A1=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96,=20=E5=8F=96=E5=87=BA=E5=BE=85=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E3=80=81=E6=89=A7=E8=A1=8C=E4=B8=AD=E7=9A=84=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/delay_task.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/models/delay_task.go b/models/delay_task.go index 5fe4b48..f874535 100644 --- a/models/delay_task.go +++ b/models/delay_task.go @@ -31,14 +31,14 @@ func (task *DelayTask) Create() (insertId int64, err error) { func (task *DelayTask) ActiveList(endTime time.Time) ([]DelayTask, error) { list := make([]DelayTask, 0) fields := "id,url,params,delay,created" - err := Db.Where("status = ? AND created <= ?", Waiting, endTime.Format(DefaultTimeFormat)).Cols(fields).Limit(task.PageSize, task.pageLimitOffset()).Find(&list) + err := Db.Where("status IN (?, ?) AND created <= ?", Waiting, Running, endTime.Format(DefaultTimeFormat)).Cols(fields).Limit(task.PageSize, task.pageLimitOffset()).Find(&list) return list, err } // 获取待执行任务数量 func (task *DelayTask) ActiveNum(endTime time.Time) (int, error) { - count ,err := Db.Where("status = ? AND created <= ?", Waiting, endTime.Format(DefaultTimeFormat)).Count(task) + count ,err := Db.Where("status IN (?, ?) AND created <= ?", Waiting, Running, endTime.Format(DefaultTimeFormat)).Count(task) return int(count), err }