- 新同步逻辑BUG修复
This commit is contained in:
@@ -1081,7 +1081,7 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs
|
|||||||
if storeIDs, skuBindInfos, err = filterStorePriceChange(ctx, storeIDs, skuBindInfos); err != nil {
|
if storeIDs, skuBindInfos, err = filterStorePriceChange(ctx, storeIDs, skuBindInfos); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
globals.SugarLogger.Debugf("updateStoresSkusWithoutSync2, storeIDs:%v, skuBindInfos:%s", storeIDs, utils.Format4Output(skuBindInfos, false))
|
// globals.SugarLogger.Debugf("updateStoresSkusWithoutSync2, storeIDs:%v, skuBindInfos:%s", storeIDs, utils.Format4Output(skuBindInfos, false))
|
||||||
|
|
||||||
userName := ctx.GetUserName()
|
userName := ctx.GetUserName()
|
||||||
needSyncIDMap := make(map[int]int)
|
needSyncIDMap := make(map[int]int)
|
||||||
|
|||||||
@@ -392,17 +392,19 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, isFull bo
|
|||||||
}, ctx, task, updateList, singleStoreHandler.GetStoreSkusBatchSize(partner.FuncUpdateStoreSkus), isContinueWhenError)
|
}, ctx, task, updateList, singleStoreHandler.GetStoreSkusBatchSize(partner.FuncUpdateStoreSkus), isContinueWhenError)
|
||||||
}
|
}
|
||||||
case 3:
|
case 3:
|
||||||
if len(stockList) > 0 {
|
for k, list := range [][]*partner.StoreSkuInfo{stockList /*, onlineList*/} {
|
||||||
_, err = putils.FreeBatchStoreSkuInfo(func(batchedStoreSkuList []*partner.StoreSkuInfo) (result interface{}, err error) {
|
if len(list) > 0 {
|
||||||
var successList []*partner.StoreSkuInfo
|
_, err = putils.FreeBatchStoreSkuInfo(func(batchedStoreSkuList []*partner.StoreSkuInfo) (result interface{}, err error) {
|
||||||
if successList, err = storeSkuHandler.UpdateStoreSkusStock(ctx, storeID, vendorStoreID, batchedStoreSkuList); err == nil {
|
var successList []*partner.StoreSkuInfo
|
||||||
successList = batchedStoreSkuList
|
if successList, err = storeSkuHandler.UpdateStoreSkusStock(ctx, storeID, vendorStoreID, batchedStoreSkuList); err == nil {
|
||||||
}
|
successList = batchedStoreSkuList
|
||||||
if len(successList) > 0 {
|
}
|
||||||
_, err = updateStoreSku(dao.GetDB(), vendorID, bareSku2Sync(batchedStoreSkuList), model.SyncFlagModifiedMask) // ?
|
if k == 0 && len(successList) > 0 {
|
||||||
}
|
_, err = updateStoreSku(dao.GetDB(), vendorID, bareSku2Sync(batchedStoreSkuList), model.SyncFlagModifiedMask) // ?
|
||||||
return nil, err
|
}
|
||||||
}, ctx, task, stockList, storeSkuHandler.GetStoreSkusBatchSize(partner.FuncUpdateStoreSkusStock), isContinueWhenError)
|
return nil, err
|
||||||
|
}, ctx, task, list, storeSkuHandler.GetStoreSkusBatchSize(partner.FuncUpdateStoreSkusStock), isContinueWhenError)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
case 4, 5:
|
case 4, 5:
|
||||||
statusList := onlineList
|
statusList := onlineList
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ func (p *PurchaseHandler) CreateStoreSkus(ctx *jxcontext.Context, storeID int, v
|
|||||||
}
|
}
|
||||||
skus[0]["spec"] = jxutils.ComposeSkuSpec(storeSku.SpecQuality, storeSku.SpecUnit)
|
skus[0]["spec"] = jxutils.ComposeSkuSpec(storeSku.SpecQuality, storeSku.SpecUnit)
|
||||||
skus[0]["price"] = foodData["price"]
|
skus[0]["price"] = foodData["price"]
|
||||||
skus[0]["stock"] = "*"
|
skus[0]["stock"] = stockCount2Mtwm(model.MaxStoreSkuStockQty)
|
||||||
skus[0]["upc"] = storeSku.Upc
|
skus[0]["upc"] = storeSku.Upc
|
||||||
if foodData["tag_id"] != nil {
|
if foodData["tag_id"] != nil {
|
||||||
skus[0]["weight"] = storeSku.Weight // weight字段仅限服饰鞋帽、美妆、日用品、母婴、生鲜果蔬、生活超市下的便利店/超市门店品类的商家使用
|
skus[0]["weight"] = storeSku.Weight // weight字段仅限服饰鞋帽、美妆、日用品、母婴、生鲜果蔬、生活超市下的便利店/超市门店品类的商家使用
|
||||||
@@ -203,6 +203,10 @@ func (p *PurchaseHandler) DeleteStoreSkus(ctx *jxcontext.Context, storeID int, v
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func stockCount2Mtwm(stock int) (mtwmStock string) {
|
||||||
|
return utils.Int2Str(stock)
|
||||||
|
}
|
||||||
|
|
||||||
func storeSku2Mtwm(storeSkuList []*partner.StoreSkuInfo, updateType int) (skuList []*mtwmapi.BareStoreFoodInfo) {
|
func storeSku2Mtwm(storeSkuList []*partner.StoreSkuInfo, updateType int) (skuList []*mtwmapi.BareStoreFoodInfo) {
|
||||||
for _, storeSku := range storeSkuList {
|
for _, storeSku := range storeSkuList {
|
||||||
skuInfo := &mtwmapi.BareStoreFoodInfo{
|
skuInfo := &mtwmapi.BareStoreFoodInfo{
|
||||||
@@ -214,11 +218,7 @@ func storeSku2Mtwm(storeSkuList []*partner.StoreSkuInfo, updateType int) (skuLis
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
if updateType == updateTypeStock {
|
if updateType == updateTypeStock {
|
||||||
if storeSku.Stock == model.MaxStoreSkuStockQty {
|
skuInfo.Skus[0].Stock = stockCount2Mtwm(storeSku.Stock)
|
||||||
skuInfo.Skus[0].Stock = "*"
|
|
||||||
} else {
|
|
||||||
skuInfo.Skus[0].Stock = utils.Int2Str(storeSku.Stock)
|
|
||||||
}
|
|
||||||
} else if updateType == updateTypePrice {
|
} else if updateType == updateTypePrice {
|
||||||
skuInfo.Skus[0].Price = jxutils.IntPrice2StandardString(storeSku.VendorPrice)
|
skuInfo.Skus[0].Price = jxutils.IntPrice2StandardString(storeSku.VendorPrice)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user