This commit is contained in:
邹宗楠
2025-07-29 10:52:51 +08:00
parent 23d57dc86f
commit 82f70f317d

View File

@@ -5,7 +5,6 @@ import (
"errors"
"fmt"
product_addV2_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_addV2/response"
"git.rosy.net.cn/jx-callback/globals"
beego "github.com/astaxie/beego/server/web"
"strings"
"time"
@@ -318,11 +317,11 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
if childrenProductId != model.NO {
// 同步价格,库存,上架
failedList2 := upDateChildrenPriceStockLaunch(api, storeSku, childrenProductId, vendorStoreID, syncType)
skuId, failedList2 := upDateChildrenPriceStockLaunch(api, storeSku, childrenProductId, vendorStoreID, syncType)
failedList = append(failedList, failedList2...)
storeSku.VendorSonSkuID = utils.Int64ToStr(childrenProductId) // (属性id skuID方案一)(自商品的商品id方案二)
storeSku.VendorSkuID = utils.Int64ToStr(childrenProductId) // 子商品主id
storeSku.VendorMainId = localThing[0].VendorThingID // 商品主id
storeSku.VendorSonSkuID = utils.Int64ToStr(skuId) // (属性id skuID方案一)(自商品的商品id方案二)
storeSku.VendorSkuID = utils.Int64ToStr(childrenProductId) // 子商品主id
storeSku.VendorMainId = localThing[0].VendorThingID // 商品主id
}
if err != nil {
@@ -446,9 +445,9 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
//storeSku.VendorSkuID = utils.Int2Str(storeSku.SkuID)
} else {
// todo 暂时关闭之后解开
upDateChildrenPriceStockLaunch(api, storeSku, utils.Str2Int64(storeSku.VendorSkuID), vendorStoreID, syncType)
skuId, _ := upDateChildrenPriceStockLaunch(api, storeSku, utils.Str2Int64(storeSku.VendorSkuID), vendorStoreID, syncType)
storeSku.VendorSonSkuID = utils.Int64ToStr(skuId) // 品库修改 售卖状态待同步 价格待同步
}
globals.SugarLogger.Debugf("-----------errr := %v", err)
//storeSku.SkuSyncStatus = model.SyncFlagStoreSkuModifiedMask // 品库修改 售卖状态待同步 价格待同步
storeSku.SkuSyncStatus = 0 // 品库修改 售卖状态待同步 价格待同步
}
@@ -673,10 +672,10 @@ func checkNameLenght(name string) string {
}
return name
}
func upDateChildrenPriceStockLaunch(api *tiktokShop.API, storeSku *dao.StoreSkuSyncInfo, childrenProductId int64, vendorStoreID, syncType string) (failedList []*partner.StoreSkuInfoWithErr) {
func upDateChildrenPriceStockLaunch(api *tiktokShop.API, storeSku *dao.StoreSkuSyncInfo, childrenProductId int64, vendorStoreID, syncType string) (skuID int64, failedList []*partner.StoreSkuInfoWithErr) {
skuId, failed := getProductSkuID(api, storeSku, syncType, childrenProductId)
if skuId == 0 || len(failed) > 0 {
return failed
return 0, failed
}
// 同步价格
if err := api.EditPrice(&sku_editPrice_request.SkuEditPriceParam{
@@ -710,7 +709,7 @@ func upDateChildrenPriceStockLaunch(api *tiktokShop.API, storeSku *dao.StoreSkuS
} else {
storeSku.SkuSyncStatus = 0
}
return failedList
return skuId, failedList
}
// 查询商品详情,获取商品的抖音skuId