重构-开启或结束所有平台商店的额外时间

This commit is contained in:
Rosy-zhudan
2019-08-25 10:05:37 +08:00
parent 881198d0f1
commit 949d4e7c8d
3 changed files with 261 additions and 123 deletions

View File

@@ -102,7 +102,6 @@ func Init() {
ScheduleTimerFunc("UpdateActStatusByTime", func() {
dao.UpdateActStatusByTime(dao.GetDB(), time.Now().Add(-48*time.Hour))
}, updateActStatusTimeList)
InitEx()
}
ScheduleTimerFunc("AutoSaleStoreSku", func() {
cms.AutoSaleStoreSku(jxcontext.AdminCtx, nil, false)
@@ -118,6 +117,7 @@ func doDailyWork() {
SaveImportantTaskID(TaskNameSyncStoreSku, SpecialTaskID)
taskID, _ := cms.CurVendorSync.SyncStoresSkus2(jxcontext.AdminCtx, dao.GetDB(), []int{model.VendorIDEBAI, model.VendorIDMTWM}, nil, nil, nil, model.SyncFlagSaleMask|model.SyncFlagPriceMask, true, true)
SaveImportantTaskID(TaskNameSyncStoreSku, taskID)
InitEx()
}
func RefreshRealMobile(ctx *jxcontext.Context, vendorID int, fromTime, toTime time.Time, isAsync, isContinueWhenError bool) (hint string, err error) {
@@ -184,14 +184,14 @@ func ScheduleTimerFunc(name string, handler func(), timeList []string) {
}
// 按时间调度一次
func ScheduleTimerFuncOnce(name string, handler func(), timeStr string) {
func ScheduleTimerFuncOnce(name string, handler func(interface{}), timeStr string, param interface{}) {
now := time.Now()
nextTime := jxutils.GetNextTimeFromList(now, []string{timeStr})
duration := nextTime.Sub(now) + 1*time.Second
globals.SugarLogger.Debugf("ScheduleTimerFuncOnce, func:%s, duration:%v", name, duration)
utils.AfterFuncWithRecover(duration, func() {
globals.SugarLogger.Debugf("ScheduleTimerFuncOnce func:%s", name)
handler()
handler(param)
})
}