- 添加对于监控平台门店状态初始版本

This commit is contained in:
gazebo
2019-06-26 16:58:38 +08:00
parent f7ec972d2e
commit 0adf3e7d31
15 changed files with 422 additions and 30 deletions

View File

@@ -16,6 +16,16 @@ import (
"git.rosy.net.cn/jx-callback/globals"
)
func Init() {
StartRefreshEbaiRealMobile()
StartDailyWork()
if globals.ReallyCallPlatformAPI {
ScheduleTimerFunc(func() {
cms.SaveAndSendAlarmVendorSnapshot(jxcontext.AdminCtx, nil, nil)
}, cms.WatchVendorStoreTimeList)
}
}
func StartRefreshEbaiRealMobile() {
if globals.ReallyCallPlatformAPI {
utils.AfterFuncWithRecover(5*time.Second, func() {
@@ -144,3 +154,14 @@ func doDailyWork() {
// cms.CurVendorSync.FullSyncStoresSkus(jxcontext.AdminCtx, dao.GetDB(), []int{model.VendorIDJD}, nil, true, true)
cms.CurVendorSync.SyncStoresSkus(jxcontext.AdminCtx, dao.GetDB(), []int{model.VendorIDJD, model.VendorIDEBAI, model.VendorIDMTWM}, nil, nil, false, true, true)
}
func ScheduleTimerFunc(handler func(), timeList []string) {
now := time.Now()
nextTime := jxutils.GetNextTimeFromList(now, timeList)
duration := nextTime.Sub(now) + 1*time.Second
globals.SugarLogger.Debugf("ScheduleTimerFunc, duration:%v", duration)
utils.AfterFuncWithRecover(duration, func() {
handler()
ScheduleTimerFunc(handler, timeList)
})
}