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,47 +347,58 @@ 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 {
for _, v := range storeSkuList { storeDetail, _ := dao.GetStoreDetail(dao.GetDB(), storeID, model.VendorIDDD, "")
skuInfo, err := tiktokApi.GetSkuDetail(v.VendorSkuID, utils.Int2Str(v.SkuID)) appOrgCode = storeDetail.VendorOrgCode
if err != nil { } else {
return nil, err appOrgCode = storeSkuList[0].VendorOrgCode
}
if skuName := vendorSku2Jx(skuInfo); skuName != nil {
skuNameList = append(skuNameList, skuName)
}
} }
//switch len(storeSkuList) { tiktokApi := getAPI(appOrgCode, storeID, vendorStoreID)
//case 1:
// if len(storeSkuList) != 0 {
//default: for _, v := range storeSkuList {
// // 列表查询门店商品 skuInfo, err := tiktokApi.GetSkuDetail(v.VendorSkuID, utils.Int2Str(v.SkuID))
// //var storeSkuMap map[string]*partner.StoreSkuInfo if err != nil {
// //if storeSkuList != nil { return nil, err
// // storeSkuMap = putils.StoreSkuList2MapByVendorSkuID(storeSkuList) }
// //} if skuName := vendorSku2Jx(skuInfo); skuName != nil {
// //for { skuNameList = append(skuNameList, skuName)
// // result, err := mtapi.RetailList(vendorStoreID, len(skuNameList), mtwmapi.GeneralMaxLimit) }
// // if err != nil { }
// // return nil, err } else {
// // } var page int64 = 1
// // if storeSkuMap == nil { var pageSize int64 = 100
// // skuNameList = append(skuNameList, vendorSkuList2Jx(result)...) for {
// // } else { skuInfo, err := tiktokApi.GetSkuDetailList(&product_listV2_request.ProductListV2Param{
// // for _, v := range result { Status: 0,
// // if storeSkuMap[v.AppFoodCode] != nil { CheckStatus: 3,
// // if skuName := vendorSku2Jx(v); skuName != nil { ProductType: 0,
// // skuNameList = append(skuNameList, skuName) Page: page,
// // } Size: pageSize,
// // } StoreId: utils.Str2Int64(vendorStoreID),
// // } })
// // } if err != nil {
// // if len(result) < mtwmapi.GeneralMaxLimit { return nil, err
// // break }
// // } for _, v := range skuInfo.Data {
// //} skuInfo, err := tiktokApi.GetSkuDetail(utils.Int64ToStr(v.ProductId), "")
//} if err != nil {
return nil, err
}
if skuName := vendorSku2Jx(skuInfo); skuName != nil {
skuNameList = append(skuNameList, skuName)
}
}
if page*pageSize > skuInfo.Total {
page++
} else {
break
}
}
}
return skuNameList, err return skuNameList, err
} }