- 处理设置假营业时间的逻辑BUG(之前逻辑在10点以后重启后,可能导致库存不能恢复)
This commit is contained in:
@@ -6,7 +6,6 @@ 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"
|
||||
@@ -160,38 +159,20 @@ 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() {
|
||||
time1 = jxutils.GetNextTimeFromList(now, startOpStoreTimeListJXCS)
|
||||
time2 = jxutils.GetNextTimeFromList(now, endOpStoreTimeListJXCS)
|
||||
} else {
|
||||
time1 = jxutils.GetNextTimeFromList(now, startOpStoreTimeListJXGY)
|
||||
time2 = jxutils.GetNextTimeFromList(now, endOpStoreTimeListJXGY)
|
||||
startTimeList := startOpStoreTimeListJXCS
|
||||
stopTimeList := endOpStoreTimeListJXCS
|
||||
if !globals.IsMainProductEnv() {
|
||||
startTimeList = startOpStoreTimeListJXGY
|
||||
stopTimeList = endOpStoreTimeListJXGY
|
||||
}
|
||||
if time1.Sub(now) < 2*time.Hour {
|
||||
utils.AfterFuncWithRecover(time1.Sub(now), func() {
|
||||
ScheduleTimerFunc(func() {
|
||||
if !IsImportantTaskRunning(TaskNameSyncStoreSku) {
|
||||
StartOrEndOpStore(true, 0, 0, false, true)
|
||||
})
|
||||
utils.AfterFuncWithRecover(time2.Sub(now), func() {
|
||||
}
|
||||
}, startTimeList)
|
||||
ScheduleTimerFunc(func() {
|
||||
if !IsImportantTaskRunning(TaskNameSyncStoreSku) {
|
||||
StartOrEndOpStore(false, 0, 0, false, true)
|
||||
})
|
||||
}
|
||||
}
|
||||
}, stopTimeList)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user