1
This commit is contained in:
@@ -215,9 +215,9 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
|
||||
|
||||
// 根据本地商品id获取线上商品是否存在,存在则只创建子商品
|
||||
// 获取本地存储映射关系,获取本地主商品id是否存在
|
||||
localThing, err := dao.GetThingToTiktokMapList(db, model.VendorIDDD, int64(storeSku.SkuID), storeDetail.VendorOrgCode)
|
||||
localThing, _ := dao.GetThingToTiktokMapList(db, model.VendorIDDD, int64(storeSku.SkuID), storeDetail.VendorOrgCode)
|
||||
mainOrderDetail, err := api.GetSkuDetailLocalID("", utils.Int2Str(storeSku.SkuID))
|
||||
if len(localThing) == 0 {
|
||||
mainOrderDetail, err := api.GetSkuDetailLocalID("", utils.Int2Str(storeSku.SkuID))
|
||||
if err != nil || mainOrderDetail == nil || mainOrderDetail.ProductIdStr == "" {
|
||||
tiktokResult, err := api.CreateStoreCommodity(param) // 创建主商品,同步主商品
|
||||
if err != nil {
|
||||
@@ -274,6 +274,43 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 线上本地都存在,但是线上审核不成功,就去更新主商品
|
||||
if mainOrderDetail.CheckStatus != tiktokShop.SkuCheckStatusPass && mainOrderDetail.CheckStatus != tiktokShop.SkuCheckStatusPassNotPutOn {
|
||||
// 更新主商品,在同步到子门店,考虑审核时间
|
||||
updateParam := &product_editV2_request.ProductEditV2Param{
|
||||
PayType: tiktokShop.TiktokPayType1,
|
||||
ReduceType: tiktokShop.SkuReduceTypePayMakeOrder,
|
||||
Weight: utils.Int2Float64(storeSku.Weight),
|
||||
DeliveryDelayDay: tiktokShop.DeliveryDelayDayToDay,
|
||||
PresellType: tiktokShop.SendGoodsTypeNow,
|
||||
Supply7dayReturn: 0,
|
||||
Mobile: storeDetail.Tel1,
|
||||
Commit: true,
|
||||
Specs: "重量|" + utils.Float64ToStr(float64(storeSku.SpecQuality)) + storeSku.SpecUnit,
|
||||
NeedRechargeMode: false,
|
||||
SellChannel: []int64{0},
|
||||
StartSaleType: 0,
|
||||
PickupMethod: "0",
|
||||
CategoryLeafId: param.CategoryLeafId,
|
||||
Name: param.Name,
|
||||
ProductFormatNew: param.ProductFormatNew,
|
||||
}
|
||||
updateParam.Pic = img
|
||||
updateParam.Description = detailImg
|
||||
updateParam.WeightUnit = tiktokShop.WeightUint_G
|
||||
updateParam.StandardBrandId = param.StandardBrandId // 默认品牌京西菜市
|
||||
updateParam.ProductId = utils.Str2Int64(storeSku.VendorMainId)
|
||||
updateParam.MainProductId = utils.Str2Int64(storeSku.VendorMainId)
|
||||
updateParam.SpecPrices = param.SpecPrices
|
||||
updateParam.ProductId = utils.Str2Int64(storeSku.VendorSkuID)
|
||||
updateParam.StoreId = utils.Str2Int64(vendorStoreID)
|
||||
if err := api.EditStoreCommodity(updateParam); err != nil {
|
||||
failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDDD], syncType)
|
||||
storeSku.VendorSkuID = utils.Int2Str(storeSku.SkuID)
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
// 主商品存在,直接同步子商品
|
||||
childrenProductId, err := api.CreateSubProduct(utils.Str2Int64(localThing[0].VendorThingID), utils.Str2Int64(vendorStoreID))
|
||||
if err != nil || childrenProductId == 0 {
|
||||
|
||||
Reference in New Issue
Block a user