+ UpdateActStatusByTime
This commit is contained in:
@@ -41,6 +41,9 @@ var (
|
|||||||
openRemoteStoreTimeList = []string{
|
openRemoteStoreTimeList = []string{
|
||||||
"23:30:00",
|
"23:30:00",
|
||||||
}
|
}
|
||||||
|
updateActStatusTimeList = []string{
|
||||||
|
"00:01:00",
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func Init() {
|
func Init() {
|
||||||
@@ -63,6 +66,10 @@ func Init() {
|
|||||||
ScheduleTimerFunc(func() {
|
ScheduleTimerFunc(func() {
|
||||||
act.RefreshPageActs(jxcontext.AdminCtx, []int{model.VendorIDEBAI}, time.Now().Add(-30*24*time.Hour), false)
|
act.RefreshPageActs(jxcontext.AdminCtx, []int{model.VendorIDEBAI}, time.Now().Add(-30*24*time.Hour), false)
|
||||||
}, refreshPageActTimeList)
|
}, refreshPageActTimeList)
|
||||||
|
|
||||||
|
ScheduleTimerFunc(func() {
|
||||||
|
dao.UpdateActStatusByTime(dao.GetDB(), time.Now())
|
||||||
|
}, updateActStatusTimeList)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -335,3 +335,17 @@ func GetEffectiveActStoreSkuInfo(db *DaoDB, actID int, vendorIDs, storeIDs, skuI
|
|||||||
err = GetRows(db, &actStoreSkuList, sql, sqlParams...)
|
err = GetRows(db, &actStoreSkuList, sql, sqlParams...)
|
||||||
return actStoreSkuList, err
|
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
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user