This commit is contained in:
邹宗楠
2022-11-08 16:21:35 +08:00
parent 8a33e0968d
commit 8ea91ef1a0
2 changed files with 55 additions and 40 deletions

View File

@@ -937,6 +937,9 @@ func PruneMissingStoreSkus(ctx *jxcontext.Context, parentTask tasksch.ITask, ven
} }
func amendAndPruneStoreStuff(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorID, storeID int, vendorStoreID string, isAsync, isContinueWhenError bool, opType int, isForceUpdate bool) (hint string, err error) { func amendAndPruneStoreStuff(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorID, storeID int, vendorStoreID string, isAsync, isContinueWhenError bool, opType int, isForceUpdate bool) (hint string, err error) {
if vendorID == model.VendorIDDD {
return "", nil
}
handler, _ := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.ISingleStoreStoreSkuHandler) handler, _ := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.ISingleStoreStoreSkuHandler)
if handler == nil { if handler == nil {
return "", fmt.Errorf("平台:%s不支持此操作", model.VendorChineseNames[vendorID]) return "", fmt.Errorf("平台:%s不支持此操作", model.VendorChineseNames[vendorID])

View File

@@ -4,6 +4,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"git.rosy.net.cn/baseapi/platformapi/mtwmapi" "git.rosy.net.cn/baseapi/platformapi/mtwmapi"
product_listV2_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_listV2/request"
sku_editPrice_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/sku_editPrice/request" sku_editPrice_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/sku_editPrice/request"
sku_syncStock_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/sku_syncStock/request" sku_syncStock_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/sku_syncStock/request"
tiktokShop "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/tiktok_api" tiktokShop "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/tiktok_api"
@@ -346,8 +347,16 @@ func (p *PurchaseHandler) UpdateStoreSkusStock(ctx *jxcontext.Context, vendorOrg
func (p *PurchaseHandler) GetStoreSkusFullInfo(ctx *jxcontext.Context, parentTask tasksch.ITask, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo) (skuNameList []*partner.SkuNameInfo, err error) { func (p *PurchaseHandler) GetStoreSkusFullInfo(ctx *jxcontext.Context, parentTask tasksch.ITask, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo) (skuNameList []*partner.SkuNameInfo, err error) {
// 查询单个门店商品 // 查询单个门店商品
tiktokApi := getAPI(storeSkuList[0].VendorOrgCode, storeID, vendorStoreID) appOrgCode := ""
if len(storeSkuList) == 0 {
storeDetail, _ := dao.GetStoreDetail(dao.GetDB(), storeID, model.VendorIDDD, "")
appOrgCode = storeDetail.VendorOrgCode
} else {
appOrgCode = storeSkuList[0].VendorOrgCode
}
tiktokApi := getAPI(appOrgCode, storeID, vendorStoreID)
if len(storeSkuList) != 0 {
for _, v := range storeSkuList { for _, v := range storeSkuList {
skuInfo, err := tiktokApi.GetSkuDetail(v.VendorSkuID, utils.Int2Str(v.SkuID)) skuInfo, err := tiktokApi.GetSkuDetail(v.VendorSkuID, utils.Int2Str(v.SkuID))
if err != nil { if err != nil {
@@ -357,36 +366,39 @@ func (p *PurchaseHandler) GetStoreSkusFullInfo(ctx *jxcontext.Context, parentTas
skuNameList = append(skuNameList, skuName) skuNameList = append(skuNameList, skuName)
} }
} }
//switch len(storeSkuList) { } else {
//case 1: var page int64 = 1
// var pageSize int64 = 100
//default: for {
// // 列表查询门店商品 skuInfo, err := tiktokApi.GetSkuDetailList(&product_listV2_request.ProductListV2Param{
// //var storeSkuMap map[string]*partner.StoreSkuInfo Status: 0,
// //if storeSkuList != nil { CheckStatus: 3,
// // storeSkuMap = putils.StoreSkuList2MapByVendorSkuID(storeSkuList) ProductType: 0,
// //} Page: page,
// //for { Size: pageSize,
// // result, err := mtapi.RetailList(vendorStoreID, len(skuNameList), mtwmapi.GeneralMaxLimit) StoreId: utils.Str2Int64(vendorStoreID),
// // if err != nil { })
// // return nil, err if err != nil {
// // } return nil, err
// // if storeSkuMap == nil { }
// // skuNameList = append(skuNameList, vendorSkuList2Jx(result)...) for _, v := range skuInfo.Data {
// // } else { skuInfo, err := tiktokApi.GetSkuDetail(utils.Int64ToStr(v.ProductId), "")
// // for _, v := range result { if err != nil {
// // if storeSkuMap[v.AppFoodCode] != nil { return nil, err
// // if skuName := vendorSku2Jx(v); skuName != nil { }
// // skuNameList = append(skuNameList, skuName) if skuName := vendorSku2Jx(skuInfo); skuName != nil {
// // } skuNameList = append(skuNameList, skuName)
// // } }
// // } }
// // } if page*pageSize > skuInfo.Total {
// // if len(result) < mtwmapi.GeneralMaxLimit { page++
// // break } else {
// // } break
// //} }
//} }
}
return skuNameList, err return skuNameList, err
} }