- FreeBatchStoreSkuInfo及FreeBatchStoreSkuSyncInfo,FreeBatchCategoryIDOp并行数改为1
- FreeBatchStoreSkuInfo及FreeBatchStoreSkuSyncInfo任务handler添加task参数
This commit is contained in:
@@ -2,41 +2,42 @@ package misc
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"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/jxcontext"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/tasksch"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/business/partner"
|
||||
"git.rosy.net.cn/jx-callback/business/partner/putils"
|
||||
"git.rosy.net.cn/baseapi"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/tasksch"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
)
|
||||
|
||||
const (
|
||||
specialSkuName = "温馨提示"
|
||||
startOpStoreStockNumber = 0
|
||||
endOpStoreStockNumber = model.MaxStoreSkuStockQty
|
||||
specialSkuName = "温馨提示"
|
||||
startOpStoreStockNumber = 0
|
||||
endOpStoreStockNumber = model.MaxStoreSkuStockQty
|
||||
startOpStoreTimeDefaultMTWM = int16(2200)
|
||||
endOpStoreTimeDefaultMTWM = int16(2355)
|
||||
endOpStoreTimeDefaultMTWM = int16(2355)
|
||||
startOpStoreTimeDefaultEBAI = int16(5)
|
||||
endOpStoreTimeDefaultEBAI = int16(2355)
|
||||
endOpStoreTimeDefaultEBAI = int16(2355)
|
||||
)
|
||||
|
||||
var (
|
||||
startOpStoreTimeListJXCS = []string {
|
||||
startOpStoreTimeListJXCS = []string{
|
||||
"22:10:00",
|
||||
}
|
||||
endOpStoreTimeListJXCS = []string {
|
||||
endOpStoreTimeListJXCS = []string{
|
||||
"06:10:00",
|
||||
}
|
||||
startOpStoreTimeListJXGY = []string {
|
||||
startOpStoreTimeListJXGY = []string{
|
||||
"22:00:00",
|
||||
}
|
||||
endOpStoreTimeListJXGY = []string {
|
||||
endOpStoreTimeListJXGY = []string{
|
||||
"06:00:00",
|
||||
}
|
||||
vendorList = map[int]bool {
|
||||
vendorList = map[int]bool{
|
||||
model.VendorIDMTWM: true,
|
||||
model.VendorIDEBAI: true,
|
||||
}
|
||||
@@ -74,7 +75,7 @@ func FilterSkuNameList(storeSkuNameList []*partner.SkuNameInfo) (filterStoreSkuN
|
||||
for _, skuNameInfo := range storeSkuNameList {
|
||||
if skuNameInfo.Name != specialSkuName {
|
||||
filterStoreSkuNameList = append(filterStoreSkuNameList, skuNameInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
return filterStoreSkuNameList
|
||||
}
|
||||
@@ -92,7 +93,7 @@ func StartOrEndOpStore(isStart bool, startTime, endTime int16, isAsync, isContin
|
||||
storeListValue := batchItemList[0].(*cms.StoreExt)
|
||||
storeID := storeListValue.ID
|
||||
if storeListValue.StoreMaps != nil {
|
||||
for _, vendorListValue := range storeListValue.StoreMaps {
|
||||
for _, vendorListValue := range storeListValue.StoreMaps {
|
||||
vendorID := int(utils.MustInterface2Int64(vendorListValue["vendorID"]))
|
||||
if _, ok := vendorList[vendorID]; ok {
|
||||
startOpStoreTime, endOpStoreTime := GetOpStoreTime(vendorID)
|
||||
@@ -107,7 +108,7 @@ func StartOrEndOpStore(isStart bool, startTime, endTime int16, isAsync, isContin
|
||||
storeSkuNameList, err := singleStoreHandler.GetStoreSkusFullInfo(ctx, task, storeID, vendorStoreID, nil)
|
||||
if err != nil {
|
||||
baseapi.SugarLogger.Errorf("StartOrEndOpStore GetStoreSkusFullInfo error:%v storeID:%d vendorID:%d vendorStoreID:%s", err, storeID, vendorID, vendorStoreID)
|
||||
} else {
|
||||
} else {
|
||||
filterStoreSkuNameList := FilterSkuNameList(storeSkuNameList)
|
||||
storeSkuList := putils.StoreSkuFullList2Bare(filterStoreSkuNameList)
|
||||
if len(storeSkuList) > 0 {
|
||||
@@ -115,8 +116,8 @@ func StartOrEndOpStore(isStart bool, startTime, endTime int16, isAsync, isContin
|
||||
AddOrDelExtraStoreOptime(vendorID, storeID, vendorStoreID, &storeListValue.Store, startOpStoreTime, endOpStoreTime, false)
|
||||
}
|
||||
|
||||
_, err = putils.FreeBatchStoreSkuInfo(func(batchedStoreSkuList []*partner.StoreSkuInfo) (result interface{}, err error) {
|
||||
for _, skuValue := range batchedStoreSkuList {
|
||||
_, err = putils.FreeBatchStoreSkuInfo(func(task tasksch.ITask, batchedStoreSkuList []*partner.StoreSkuInfo) (result interface{}, err error) {
|
||||
for _, skuValue := range batchedStoreSkuList {
|
||||
skuValue.Stock = GetStockValue(isStart)
|
||||
}
|
||||
//var successList []*partner.StoreSkuInfo
|
||||
@@ -160,17 +161,17 @@ func StartOrEndOpStore(isStart bool, startTime, endTime int16, isAsync, isContin
|
||||
func InitEx() {
|
||||
if globals.IsMainProductEnv() {
|
||||
ScheduleTimerFunc(func() {
|
||||
StartOrEndOpStore(true, 0, 0, false, true)
|
||||
}, startOpStoreTimeListJXCS)
|
||||
StartOrEndOpStore(true, 0, 0, false, true)
|
||||
}, startOpStoreTimeListJXCS)
|
||||
ScheduleTimerFunc(func() {
|
||||
StartOrEndOpStore(false, 0, 0, false, true)
|
||||
}, endOpStoreTimeListJXCS)
|
||||
StartOrEndOpStore(false, 0, 0, false, true)
|
||||
}, endOpStoreTimeListJXCS)
|
||||
} else {
|
||||
ScheduleTimerFunc(func() {
|
||||
StartOrEndOpStore(true, 0, 0, false, true)
|
||||
}, startOpStoreTimeListJXGY)
|
||||
StartOrEndOpStore(true, 0, 0, false, true)
|
||||
}, startOpStoreTimeListJXGY)
|
||||
ScheduleTimerFunc(func() {
|
||||
StartOrEndOpStore(false, 0, 0, false, true)
|
||||
}, endOpStoreTimeListJXGY)
|
||||
StartOrEndOpStore(false, 0, 0, false, true)
|
||||
}, endOpStoreTimeListJXGY)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user