- fixed bug in updateStoreSkusWithoutSync
This commit is contained in:
@@ -53,6 +53,10 @@ type IOrderManager interface {
|
||||
LoadWaybill(vendorWaybillID string, waybillVendorID int) (bill *model.Waybill, err error)
|
||||
}
|
||||
|
||||
// purchase handler中
|
||||
// 所有Sync,Refresh开头的函数都必须自己清理sync_status标记
|
||||
// 所有非以Sync,Refresh开头的函数不用自己清理sync_status标记(VendorSync统一处理)
|
||||
|
||||
type IPurchasePlatformHandler interface {
|
||||
GetStatusFromVendorStatus(vendorStatus string) int
|
||||
GetOrder(vendorOrderID string) (order *model.GoodsOrder, err error)
|
||||
|
||||
@@ -25,6 +25,9 @@ type tStoreSkuBindExt struct {
|
||||
// 京东到家,以有库存表示关注(认领)
|
||||
func (p *PurchaseHandler) SyncStoresSkus(ctx *jxcontext.Context, parentTask tasksch.ITask, db *dao.DaoDB, storeIDs []int, skuIDs []int, isAsync bool) (hint string, err error) {
|
||||
globals.SugarLogger.Debugf("jd SyncStoresSkus, storeIDs:%v, skuIDs:%v", storeIDs, skuIDs)
|
||||
if len(skuIDs) == 0 {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
parallelCount := 1
|
||||
if len(skuIDs) < MaxSkuBatchSize {
|
||||
@@ -57,7 +60,7 @@ func (p *PurchaseHandler) SyncStoresSkus(ctx *jxcontext.Context, parentTask task
|
||||
}
|
||||
if err = dao.GetRows(db, &storeSkus, sql, append(sqlParams, sqlWhereParams...)...); err == nil {
|
||||
outStationNo := utils.Int2Str(storeID)
|
||||
task := tasksch.RunParallelTask("SyncStoresSkus inner", tasksch.NewParallelConfig().SetBatchSize(MaxSkuBatchSize), ctx.GetUserName(), func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (interface{}, error) {
|
||||
task := tasksch.NewParallelTask("SyncStoresSkus inner", tasksch.NewParallelConfig().SetBatchSize(MaxSkuBatchSize), ctx.GetUserName(), func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (interface{}, error) {
|
||||
var skuPriceInfoList []*jdapi.SkuPriceInfo
|
||||
var skuVendibilityList []*jdapi.StockVendibility
|
||||
var skuStockList []*jdapi.SkuStock
|
||||
@@ -95,6 +98,7 @@ func (p *PurchaseHandler) SyncStoresSkus(ctx *jxcontext.Context, parentTask task
|
||||
}
|
||||
if globals.EnableStoreWrite {
|
||||
// todo 以下可以优化为并行操作
|
||||
// globals.SugarLogger.Debug(utils.Format4Output(skuVendibilityList, false), utils.Format4Output(skuPriceInfoList, false), utils.Format4Output(skuStockList, false))
|
||||
if len(skuVendibilityList) > 0 {
|
||||
_, err = api.JdAPI.BatchUpdateVendibility(outStationNo, "", skuVendibilityList, ctx.GetUserName())
|
||||
}
|
||||
@@ -107,6 +111,7 @@ func (p *PurchaseHandler) SyncStoresSkus(ctx *jxcontext.Context, parentTask task
|
||||
}
|
||||
return nil, err
|
||||
}, storeSkus)
|
||||
t.AddChild(task).Run()
|
||||
if _, err = task.GetResult(0); err == nil {
|
||||
sql := `
|
||||
UPDATE store_sku_bind t1
|
||||
|
||||
Reference in New Issue
Block a user