This commit is contained in:
邹宗楠
2023-01-03 16:17:16 +08:00
parent 36059bd1dc
commit 9902bf1ed4
4 changed files with 28 additions and 37 deletions

View File

@@ -343,7 +343,6 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
}
}
globals.SugarLogger.Debugf("foodDataList=======mtwm %s", utils.Format4Output(foodDataList, false))
if globals.EnableMtwmStoreWrite {
if len(foodDataList) == 1 {
foodDataList[0]["skus"] = string(utils.MustMarshal(foodDataList[0]["skus"]))

View File

@@ -130,17 +130,15 @@ func (p *PurchaseHandler) UpdateStoreSkusStatus(ctx *jxcontext.Context, vendorOr
if status == model.SkuStatusNormal { // 下架
for _, v := range storeSkuList {
// 子品商品id获取skuId
childrenSkuId, failedList := getProductSkuId4UpdateStock(api, v, storeID)
if len(failedList) > 0 {
continue
}
//childrenSkuId, failedList := getProductSkuId4UpdateStock(api, v, storeID)
//if len(failedList) > 0 {
// continue
//}
param := &sku_syncStock_request.SkuSyncStockParam{
SkuId: childrenSkuId,
ProductId: utils.Str2Int64(v.VendorSkuID),
Incremental: false,
IdempotentId: "",
StockNum: 99999,
OutWarehouseId: vendorStoreID,
ProductId: utils.Str2Int64(v.VendorSkuID),
Incremental: false,
StockNum: 99999,
OutSkuId: int64(v.SkuID),
}
if err := api.UpdateSkuStock(param); err != nil {
failedList = append(failedList, putils.GetErrMsg2FailedSingleList(v, err, storeID, model.VendorChineseNames[model.VendorIDDD], fmt.Sprintf("上架商品,库存值最大化.%s", utils.Format4Output(param, false)))...)
@@ -149,18 +147,16 @@ func (p *PurchaseHandler) UpdateStoreSkusStatus(ctx *jxcontext.Context, vendorOr
} else { // 上架
for _, v := range storeSkuList {
// 子品商品id获取skuId
childrenSkuId, failedList := getProductSkuId4UpdateStock(api, v, storeID)
if len(failedList) > 0 {
continue
}
//childrenSkuId, failedList := getProductSkuId4UpdateStock(api, v, storeID)
//if len(failedList) > 0 {
// continue
//}
param := &sku_syncStock_request.SkuSyncStockParam{
SkuId: childrenSkuId,
ProductId: utils.Str2Int64(v.VendorSkuID),
Incremental: false,
IdempotentId: "",
StockNum: 0,
OutWarehouseId: vendorStoreID,
ProductId: utils.Str2Int64(v.VendorSkuID),
Incremental: false,
StockNum: 0,
OutSkuId: int64(v.SkuID),
}
if err := api.UpdateSkuStock(param); err != nil {
failedList = append(failedList, putils.GetErrMsg2FailedSingleList(v, err, storeID, model.VendorChineseNames[model.VendorIDDD], fmt.Sprintf("下架商品,库存值为0失败.%s", utils.Format4Output(param, false)))...)
@@ -203,18 +199,16 @@ func (p *PurchaseHandler) UpdateStoreSkusStock(ctx *jxcontext.Context, vendorOrg
tiktokApi := getAPI(storeSkuList[0].VendorOrgCode, storeID, vendorStoreID)
for _, v := range storeSkuList {
// 子品商品id获取skuId
childrenSkuId, failedList := getProductSkuId4UpdateStock(tiktokApi, v, storeID)
if len(failedList) > 0 {
continue
}
//childrenSkuId, failedList := getProductSkuId4UpdateStock(tiktokApi, v, storeID)
//if len(failedList) > 0 {
// continue
//}
stockNum := &sku_syncStock_request.SkuSyncStockParam{
SkuId: childrenSkuId,
ProductId: utils.Str2Int64(v.VendorSkuID),
Incremental: false,
IdempotentId: "",
StockNum: int64(v.Stock),
OutWarehouseId: vendorStoreID,
ProductId: utils.Str2Int64(v.VendorSkuID),
Incremental: false,
StockNum: int64(v.Stock),
OutSkuId: int64(v.SkuID),
}
if stockNum.StockNum == 0 {
stockNum.StockNum = 99999

View File

@@ -529,12 +529,10 @@ func upDateChildrenPriceStockLaunch(api *tiktokShop.API, storeSku *dao.StoreSkuS
}
// 同步库存
paramStock := &sku_syncStock_request.SkuSyncStockParam{
SkuId: skuId,
ProductId: childrenProductId,
Incremental: false,
IdempotentId: "",
StockNum: int64(storeSku.Stock),
OutWarehouseId: vendorStoreID,
ProductId: childrenProductId,
Incremental: false,
StockNum: int64(storeSku.Stock),
OutSkuId: int64(storeSku.SkuID),
}
if paramStock.StockNum == 0 {
paramStock.StockNum = 99999