1
This commit is contained in:
@@ -28,7 +28,6 @@ import (
|
|||||||
"git.rosy.net.cn/jx-callback/globals"
|
"git.rosy.net.cn/jx-callback/globals"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
|
||||||
"unicode"
|
"unicode"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -274,63 +273,51 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 线上本地都存在,但是线上审核不成功,就去更新主商品
|
|
||||||
mainOrderDetail = loadMainProductId(api, storeSku)
|
|
||||||
if mainOrderDetail.CheckStatus == tiktokShop.SkuCheckStatusProhibit || mainOrderDetail.CheckStatus == tiktokShop.SkuCheckStatusNotPass {
|
|
||||||
// 更新主商品,在同步到子门店,考虑审核时间
|
|
||||||
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 = mainOrderDetail.ProductId
|
|
||||||
updateParam.MainProductId = mainProductId
|
|
||||||
updateParam.SpecPrices = param.SpecPrices
|
|
||||||
//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)
|
|
||||||
} else {
|
|
||||||
localThing[0].UpdatedAt = time.Now()
|
|
||||||
localThing[0].SyncStatus = 0
|
|
||||||
localThing[0].ThingType = model.ThingTypeSku
|
|
||||||
dao.UpdateThingMap(localThing[0])
|
|
||||||
}
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
// 主商品存在,直接同步子商品
|
// 主商品存在,直接同步子商品
|
||||||
childrenProductId, err := api.CreateSubProduct(utils.Str2Int64(localThing[0].VendorThingID), utils.Str2Int64(vendorStoreID))
|
childrenProductId, err := api.CreateSubProduct(utils.Str2Int64(localThing[0].VendorThingID), utils.Str2Int64(vendorStoreID))
|
||||||
//if err != nil && strings.Contains(err.Error(), "2010001") { // 子品已经同步了但本地不存在
|
//if strings.Contains(err.Error(), "") {
|
||||||
// mainOrderDetailSkuId, _ := api.GetSkuDetailLocalID("", utils.Int2Str(storeSku.SkuID))
|
// // 线上本地都存在,但是线上审核不成功,就去更新主商品
|
||||||
// globals.SugarLogger.Debugf("==GetSkuDetailLocalID === %s", utils.Format4Output(mainOrderDetailSkuId, false))
|
// mainOrderDetail = loadMainProductId(api, storeSku)
|
||||||
// if mainOrderDetailSkuId.MainProductId != 0 { // 子品
|
// if mainOrderDetail.CheckStatus == tiktokShop.SkuCheckStatusProhibit || mainOrderDetail.CheckStatus == tiktokShop.SkuCheckStatusNotPass {
|
||||||
// storeSku.VendorSonSkuID = mainOrderDetailSkuId.ProductIdStr // (属性id skuID方案一)(自商品的商品id方案二)
|
// // 更新主商品,在同步到子门店,考虑审核时间
|
||||||
// storeSku.SkuSyncStatus = 0
|
// updateParam := &product_editV2_request.ProductEditV2Param{
|
||||||
// storeSku.VendorSkuID = mainOrderDetailSkuId.ProductIdStr // 子商品主id
|
// PayType: tiktokShop.TiktokPayType1,
|
||||||
// storeSku.VendorMainId = utils.Int64ToStr(mainOrderDetailSkuId.MainProductId) // 主品id
|
// ReduceType: tiktokShop.SkuReduceTypePayMakeOrder,
|
||||||
// childrenProductId = mainOrderDetailSkuId.ProductId
|
// Weight: utils.Int2Float64(storeSku.Weight),
|
||||||
// } else { // 主品
|
// 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 = mainOrderDetail.ProductId
|
||||||
|
// updateParam.MainProductId = mainProductId
|
||||||
|
// updateParam.SpecPrices = param.SpecPrices
|
||||||
|
// //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)
|
||||||
|
// } else {
|
||||||
|
// localThing[0].UpdatedAt = time.Now()
|
||||||
|
// localThing[0].SyncStatus = 0
|
||||||
|
// localThing[0].ThingType = model.ThingTypeSku
|
||||||
|
// dao.UpdateThingMap(localThing[0])
|
||||||
|
// }
|
||||||
// continue
|
// continue
|
||||||
// }
|
// }
|
||||||
//} else
|
//}
|
||||||
if err != nil || childrenProductId == 0 {
|
if err != nil || childrenProductId == 0 {
|
||||||
failedList = putils.GetErrMsg2FailedSingleList(storeSku, err, storeID, model.VendorChineseNames[model.VendorIDDD], syncType)
|
failedList = putils.GetErrMsg2FailedSingleList(storeSku, err, storeID, model.VendorChineseNames[model.VendorIDDD], syncType)
|
||||||
storeSku.SkuSyncStatus = model.SyncFlagStoreSkuModifiedMask
|
storeSku.SkuSyncStatus = model.SyncFlagStoreSkuModifiedMask
|
||||||
|
|||||||
Reference in New Issue
Block a user