This commit is contained in:
richboo111
2022-11-16 10:45:57 +08:00
parent 4e2fc9e4c0
commit 7ba43abb27
4 changed files with 53 additions and 11 deletions

View File

@@ -4,6 +4,7 @@ import (
"bytes"
"errors"
"fmt"
"git.rosy.net.cn/jx-callback/business/partner/purchase/mtwm"
"git.rosy.net.cn/jx-callback/business/partner/purchase/tiktok_store"
"io"
"math"
@@ -6638,11 +6639,25 @@ func SyncTiktokMainIdToLocal(ctx *jxcontext.Context, param *tiktok_store.MainSku
}
//批量更新美团商品进货价
func BatchSetRestockingPrice(ctx *jxcontext.Context, preData map[string]interface{}) error {
//spuData := []*mtwmapi.SpuData{}
//for k, v := range preData {
// //获取京西平台storeID
// err := dao.GetStoreDetail()
//}
func BatchSetRestockingPrice(ctx *jxcontext.Context, preData map[string][]mtwmapi.SpuData) error {
var params []*mtwmapi.SpuData
for k, v := range preData {
//获取京西平台storeID
if storeID, vendorOrgCode, err := dao.GetCodeAndIDByMeiTuan(k); err != nil {
return errors.New(fmt.Sprintf("获取京西本地门店ID失败:%v 请重试", err))
} else {
for _, i := range v {
param := &mtwmapi.SpuData{
AppSpuCode: i.AppSpuCode,
SkuID: i.SkuID,
PurchasePrice: i.PurchasePrice,
}
params = append(params, param)
}
if err := mtwm.GetAPI(vendorOrgCode, storeID, "").BatchSetRestockingPrice(ctx.GetTrackInfo(), k, params); err != nil {
return err
}
}
}
return nil
}