- 添加dailyWork支持,当前订是同步京东门店价格
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/tasksch"
|
||||
@@ -78,3 +79,24 @@ func RefreshRealMobile(ctx *jxcontext.Context, vendorID int, fromTime, toTime ti
|
||||
}
|
||||
return hint, err
|
||||
}
|
||||
|
||||
func StartDailyWork() {
|
||||
if globals.ReallyCallPlatformAPI {
|
||||
now := time.Now()
|
||||
runTime := time.Date(now.Year(), now.Month(), now.Day(), 0, 25, 0, 0, time.Local) // 凌晨00:25点开始执行
|
||||
waitDuration := runTime.Sub(now)
|
||||
if waitDuration < 5*time.Second {
|
||||
waitDuration += 24 * time.Hour
|
||||
}
|
||||
globals.SugarLogger.Debugf("dailyWork waitDuration:%d minutes", waitDuration/time.Minute)
|
||||
utils.AfterFuncWithRecover(waitDuration, func() {
|
||||
doDailyWork()
|
||||
StartDailyWork()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func doDailyWork() {
|
||||
globals.SugarLogger.Debug("doDailyWork")
|
||||
cms.CurVendorSync.FullSyncStoresSkus(jxcontext.AdminCtx, dao.GetDB(), []int{model.VendorIDJD}, nil, true, true)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user