1
This commit is contained in:
@@ -3,6 +3,7 @@ package enterprise
|
||||
import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/platformapi/ebaiapi"
|
||||
"git.rosy.net.cn/baseapi/platformapi/jdapi"
|
||||
"git.rosy.net.cn/baseapi/platformapi/mtwmapi"
|
||||
tao "git.rosy.net.cn/baseapi/platformapi/tao_vegetable"
|
||||
domain585 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability585/domain"
|
||||
@@ -53,6 +54,11 @@ func CompareJxVendorSku(jxStoreId int, vendorIds []int) (string, error) {
|
||||
for _, sm := range storeMap {
|
||||
switch sm.VendorID {
|
||||
case model.VendorIDJD:
|
||||
if errs := JdSyncSkuPriceAndStatus(db, sm, skuMap); err != nil {
|
||||
errListToStr.WriteString(errs.Error())
|
||||
globals.SugarLogger.Debugf("京东同步商品异常信息: %v", errs)
|
||||
}
|
||||
continue
|
||||
case model.VendorIDMTWM:
|
||||
if errs := MtWmSyncSkuPriceAndStatus(db, sm, skuMap); errs != nil {
|
||||
errListToStr.WriteString(errs.Error())
|
||||
@@ -448,74 +454,18 @@ func TiktokSyncSkuPriceAndStatus(db *dao.DaoDB, sm *model.StoreMap, skuMap map[s
|
||||
}
|
||||
|
||||
// JdSyncSkuPriceAndStatus 校验京东平台和京西系统商品差异
|
||||
//func JdSyncSkuPriceAndStatus(db *dao.DaoDB, sm *model.StoreMap, skuMap map[string]*model.StoreSkuBind) (err error) {
|
||||
// var (
|
||||
// tiktokApi = apimanager.CurAPIManager.GetAPI(sm.VendorID, sm.VendorOrgCode).(*jdshopapi.API)
|
||||
// page = 0
|
||||
// foodListData = make([]product_listV2_response.DataItem, 0, 0)
|
||||
// errs = make([]string, 0, 0)
|
||||
// )
|
||||
//
|
||||
// for {
|
||||
// param := &product_listV2_request.ProductListV2Param{
|
||||
// Page: int64(page),
|
||||
// Size: 100,
|
||||
// StoreId: utils.Str2Int64(sm.VendorStoreID),
|
||||
// }
|
||||
// foodList, err := tiktokApi.GetSkuDetailList(param)
|
||||
// if err != nil {
|
||||
// globals.SugarLogger.Debugf("抖音商品价格和上下架状态获取平台商品异常 :%v", err)
|
||||
// continue
|
||||
// }
|
||||
//
|
||||
// foodListData = append(foodListData, foodList.Data...)
|
||||
// if len(foodList.Data) < 100 {
|
||||
// break
|
||||
// }
|
||||
// page += 1
|
||||
// }
|
||||
//
|
||||
// for _, vsl := range foodListData {
|
||||
// if sku, ok := skuMap[vsl.OuterProductId]; ok {
|
||||
// // 同步商品价格
|
||||
// if vsl.DiscountPrice != int64(sku.EbaiPrice) {
|
||||
// _, err = cms.CurVendorSync.SyncStoresSkus2(jxcontext.AdminCtx, nil, 0, db, []int{sm.VendorID}, []int{sku.StoreID}, false, []int{sku.SkuID}, []int{27379}, model.SyncFlagPriceMask, true, true)
|
||||
// if err != nil {
|
||||
// errs = append(errs, fmt.Sprintf("抖音对比商品价格异常skuid:%d,错误%v", sku.SkuID, err))
|
||||
// }
|
||||
// }
|
||||
// // 同步商品上下架状态
|
||||
// // 0-在线 1-下线
|
||||
// // 本地sku.Status 0-不可售,1-可售
|
||||
// if vsl.Status == int64(sku.Status) {
|
||||
// if sku.Status == model.SkuStatusNormal {
|
||||
// param := &sku_syncStock_request.SkuSyncStockParam{
|
||||
// ProductId: sku.DdID,
|
||||
// Incremental: false,
|
||||
// StockNum: 99999,
|
||||
// OutSkuId: int64(sku.SkuID),
|
||||
// }
|
||||
// if err = tiktokApi.UpdateSkuStock(param); err != nil {
|
||||
// errs = append(errs, fmt.Sprintf("抖音对比商品上架异常skuid:%d,错误%v", sku.SkuID, err))
|
||||
// }
|
||||
// } else {
|
||||
// param := &sku_syncStock_request.SkuSyncStockParam{
|
||||
// ProductId: sku.DdID,
|
||||
// Incremental: false,
|
||||
// StockNum: 0,
|
||||
// OutSkuId: int64(sku.SkuID),
|
||||
// }
|
||||
// if err = tiktokApi.UpdateSkuStock(param); err != nil {
|
||||
// errs = append(errs, fmt.Sprintf("抖音对比商品下架异常skuid:%d,错误%v", sku.SkuID, err))
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if len(errs) == model.NO {
|
||||
// return nil
|
||||
// }
|
||||
//
|
||||
// return fmt.Errorf("%s", strings.Join(errs, ","))
|
||||
//}
|
||||
func JdSyncSkuPriceAndStatus(db *dao.DaoDB, sm *model.StoreMap, skuMap map[string]*model.StoreSkuBind) (err error) {
|
||||
var (
|
||||
jdsApi = apimanager.CurAPIManager.GetAPI(sm.VendorID, sm.VendorOrgCode).(*jdapi.API)
|
||||
)
|
||||
|
||||
for _, v := range skuMap {
|
||||
skuVendibilityList := append([]*jdapi.StockVendibility{}, &jdapi.StockVendibility{
|
||||
OutSkuId: utils.Int2Str(v.SkuID),
|
||||
DoSale: v.Status == model.SkuStatusNormal,
|
||||
})
|
||||
jdsApi.BatchUpdateVendibility(jxcontext.AdminCtx.GetTrackInfo(), "", sm.VendorStoreID, skuVendibilityList, jxcontext.AdminCtx.GetUserName())
|
||||
}
|
||||
|
||||
return fmt.Errorf("京东运行结束")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user