This commit is contained in:
邹宗楠
2023-10-26 16:15:02 +08:00
parent 5defccb4a7
commit 767ece0e27

View File

@@ -159,15 +159,10 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
continue
}
tiktokResult, err := api.CreateStoreCommodity(param) // 创建主商品,同步主商品
globals.SugarLogger.Debugf("====================tiktokResult := %s", utils.Format4Output(tiktokResult, false))
globals.SugarLogger.Debugf("====================err:= %v", err)
if err != nil {
if strings.Contains(err.Error(), "outProductId或者outerProductId已经存在") { // 主品以创建但是未返回出来
if err != nil && strings.Contains(err.Error(), "outProductId或者outerProductId已经存在") { // 主品以创建但是未返回出来
mainProductDetail, _ := api.GetSkuDetail("", utils.Int2Str(storeSku.SkuID))
globals.SugarLogger.Debugf("====================mainProductDetail := %s", utils.Format4Output(mainProductDetail, false))
if mainProductDetail != nil || mainProductDetail.ProductId != 0 {
tiktokResult.ProductId = mainProductDetail.ProductId
specPrices := make([]product_addV2_response.SkuItem, 0, 0)
for _, v := range mainProductDetail.SpecPrices {
specPrices = append(specPrices, product_addV2_response.SkuItem{
@@ -186,8 +181,9 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
failedList = putils.GetErrMsg2FailedSingleList(storeSku, err, storeID, model.VendorChineseNames[model.VendorIDDD], syncType)
continue
}
}
//dao.UpdateThingMap(db, model.ThingTypeSyncFail, utils.Int64ToStr(time.Now().Unix()), storeSku.SkuID, model.VendorIDDD, storeDetail.VendorOrgCode)
} else {
failedList = putils.GetErrMsg2FailedSingleList(storeSku, err, storeID, model.VendorChineseNames[model.VendorIDDD], syncType)
continue
}
if tiktokResult.ProductId > model.NO {