Merge branch 'jdshop' of https://e.coding.net/rosydev/jx-callback into jdshop
This commit is contained in:
@@ -217,14 +217,13 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
|
||||
var mainProductId int64 = 0
|
||||
localThing, _ := dao.GetThingToTiktokMapList(db, model.VendorIDDD, int64(storeSku.SkuID), storeDetail.VendorOrgCode)
|
||||
mainOrderDetail, err := api.GetSkuDetailLocalID("", utils.Int2Str(storeSku.SkuID))
|
||||
if mainOrderDetail.MainProductId != 0 {
|
||||
mainProductId = mainOrderDetail.MainProductId
|
||||
} else {
|
||||
mainProductId = mainOrderDetail.ProductId
|
||||
if err != nil {
|
||||
failedList = putils.GetErrMsg2FailedSingleList(storeSku, err, storeID, model.VendorChineseNames[model.VendorIDDD], syncType)
|
||||
continue
|
||||
}
|
||||
|
||||
if len(localThing) == 0 {
|
||||
if err != nil || mainOrderDetail == nil || mainOrderDetail.ProductIdStr == "" {
|
||||
if mainOrderDetail == nil || mainOrderDetail.ProductIdStr == "" {
|
||||
tiktokResult, err := api.CreateStoreCommodity(param) // 创建主商品,同步主商品
|
||||
if err != nil {
|
||||
failedList = putils.GetErrMsg2FailedSingleList(storeSku, err, storeID, model.VendorChineseNames[model.VendorIDDD], syncType)
|
||||
@@ -239,6 +238,8 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
|
||||
for _, v := range tiktokResult.Sku {
|
||||
attrId = append(attrId, utils.Int64ToStr(v.SkuId))
|
||||
}
|
||||
|
||||
mainProductId = tiktokResult.ProductId
|
||||
storeSku.VendorSkuID = utils.Int2Str(storeSku.SkuID)
|
||||
storeSku.SkuSyncStatus = model.SyncFlagNewMask // 只创建主品,子品都没做
|
||||
storeSku.VendorMainId = utils.Int64ToStr(tiktokResult.ProductId)
|
||||
@@ -246,6 +247,11 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
|
||||
storeSku.VendorSonSkuID = utils.Int2Str(storeSku.SkuID) // 还没同步子商品
|
||||
failedList = putils.GetErrMsg2FailedSingleList(storeSku, errors.New("只创建了主商品,没创建子商品"), storeID, model.VendorChineseNames[model.VendorIDDD], syncType)
|
||||
} else {
|
||||
if mainOrderDetail.MainProductId != 0 {
|
||||
mainProductId = mainOrderDetail.MainProductId
|
||||
} else {
|
||||
mainProductId = mainOrderDetail.ProductId
|
||||
}
|
||||
// 本地不存在,线上存在.直接创建子商品保存本地同步记录
|
||||
var childrenProductId int64 = 0
|
||||
if mainOrderDetail.CheckStatus != tiktokShop.SkuCheckStatusPass && mainOrderDetail.CheckStatus != tiktokShop.SkuCheckStatusPassNotPutOn {
|
||||
@@ -421,18 +427,20 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
|
||||
mainIdInt = utils.Str2Int64(storeSku.VendorMainId)
|
||||
}
|
||||
|
||||
globals.SugarLogger.Debugf("==storeSku := %s", utils.Format4Output(storeSku, false))
|
||||
// 修改商品
|
||||
param.ProductId = mainIdInt
|
||||
param.MainProductId = mainIdInt
|
||||
//param.StoreId = utils.Str2Int64(vendorStoreID)
|
||||
param.SpecPrices = GetSpecPrices(param.Specs, vendorStoreID, param.MainProductId, storeSku)
|
||||
globals.SugarLogger.Debugf("==param := %s", utils.Format4Output(param, false))
|
||||
if err := api.EditStoreCommodity(param); err != nil {
|
||||
failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDDD], syncType)
|
||||
storeSku.VendorSkuID = utils.Int2Str(storeSku.SkuID)
|
||||
continue
|
||||
}
|
||||
// todo 更主品的同间考虑更新子品,子品的更新只能重新分配子品,在更新价格
|
||||
//if storeSku.VendorSkuID != "" && len(storeSku.VendorSkuID) > 19 {
|
||||
// failedList = upDateChildrenPriceStockLaunch(api, storeSku, utils.Str2Int64(storeSku.VendorSkuID), vendorStoreID, syncType)
|
||||
//}
|
||||
storeSku.StoreSkuStatus = 57 // 品库修改 售卖状态待同步 价格待同步
|
||||
}
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user