diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index 63c4be009..d4b3fd529 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -99,6 +99,7 @@ func doDailyWork() { globals.SugarLogger.Debug("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) + InitEx() netprinter.RebindAllPrinters(jxcontext.AdminCtx, false, true) } diff --git a/business/jxstore/misc/misc2.go b/business/jxstore/misc/misc2.go index 2b4a47a44..29d8ea465 100644 --- a/business/jxstore/misc/misc2.go +++ b/business/jxstore/misc/misc2.go @@ -6,6 +6,7 @@ import ( "git.rosy.net.cn/baseapi" "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" "git.rosy.net.cn/jx-callback/business/model" @@ -159,19 +160,38 @@ func StartOrEndOpStore(isStart bool, startTime, endTime int16, isAsync, isContin } func InitEx() { + // if globals.IsMainProductEnv() { + // ScheduleTimerFunc(func() { + // StartOrEndOpStore(true, 0, 0, false, true) + // }, startOpStoreTimeListJXCS) + // ScheduleTimerFunc(func() { + // StartOrEndOpStore(false, 0, 0, false, true) + // }, endOpStoreTimeListJXCS) + // } else { + // ScheduleTimerFunc(func() { + // StartOrEndOpStore(true, 0, 0, false, true) + // }, startOpStoreTimeListJXGY) + // ScheduleTimerFunc(func() { + // StartOrEndOpStore(false, 0, 0, false, true) + // }, endOpStoreTimeListJXGY) + // } + var ( + time1, time2 time.Time + ) + now := time.Now() if globals.IsMainProductEnv() { - ScheduleTimerFunc(func() { - StartOrEndOpStore(true, 0, 0, false, true) - }, startOpStoreTimeListJXCS) - ScheduleTimerFunc(func() { - StartOrEndOpStore(false, 0, 0, false, true) - }, endOpStoreTimeListJXCS) + time1 = jxutils.GetNextTimeFromList(now, startOpStoreTimeListJXCS) + time2 = jxutils.GetNextTimeFromList(now, endOpStoreTimeListJXCS) } else { - ScheduleTimerFunc(func() { + time1 = jxutils.GetNextTimeFromList(now, startOpStoreTimeListJXGY) + time2 = jxutils.GetNextTimeFromList(now, endOpStoreTimeListJXGY) + } + if time1.Sub(now) < 2*time.Hour { + utils.AfterFuncWithRecover(time1.Sub(now), func() { StartOrEndOpStore(true, 0, 0, false, true) - }, startOpStoreTimeListJXGY) - ScheduleTimerFunc(func() { + }) + utils.AfterFuncWithRecover(time2.Sub(now), func() { StartOrEndOpStore(false, 0, 0, false, true) - }, endOpStoreTimeListJXGY) + }) } } diff --git a/main.go b/main.go index b0e563a2a..c5c8d3e42 100644 --- a/main.go +++ b/main.go @@ -56,7 +56,6 @@ func Init() { if globals.IsProductEnv() { ebai.CurPurchaseHandler.StartRefreshComment() - misc.InitEx() } misc.Init() }