+ UpdateActStatusByTime

This commit is contained in:
gazebo
2019-07-25 10:06:04 +08:00
parent 05b2c07861
commit 60607674b7
2 changed files with 21 additions and 0 deletions

View File

@@ -41,6 +41,9 @@ var (
openRemoteStoreTimeList = []string{
"23:30:00",
}
updateActStatusTimeList = []string{
"00:01:00",
}
)
func Init() {
@@ -63,6 +66,10 @@ func Init() {
ScheduleTimerFunc(func() {
act.RefreshPageActs(jxcontext.AdminCtx, []int{model.VendorIDEBAI}, time.Now().Add(-30*24*time.Hour), false)
}, refreshPageActTimeList)
ScheduleTimerFunc(func() {
dao.UpdateActStatusByTime(dao.GetDB(), time.Now())
}, updateActStatusTimeList)
}
}

View File

@@ -335,3 +335,17 @@ func GetEffectiveActStoreSkuInfo(db *DaoDB, actID int, vendorIDs, storeIDs, skuI
err = GetRows(db, &actStoreSkuList, sql, sqlParams...)
return actStoreSkuList, err
}
func UpdateActStatusByTime(db *DaoDB, refTime time.Time) (num int64, err error) {
sql := `
UPDATE act t1
SET t1.status = ?
WHERE t1.status < ? AND t1.end_at < ?;`
sqlParams := []interface{}{
model.ActStatusEnded,
model.ActStatusCanceled,
utils.DefaultTimeValue,
}
num, err = ExecuteSQL(db, sql, sqlParams...)
return num, err
}