- 设置门店假营业时间放在每晚例行同步任务之后

This commit is contained in:
gazebo
2019-08-02 16:23:36 +08:00
parent 8518248080
commit 87d78777af
3 changed files with 31 additions and 11 deletions

View File

@@ -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)
}

View File

@@ -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)
})
}
}

View File

@@ -56,7 +56,6 @@ func Init() {
if globals.IsProductEnv() {
ebai.CurPurchaseHandler.StartRefreshComment()
misc.InitEx()
}
misc.Init()
}