- GetVendorStoreSkusInfo处理skuID与平台绑定不正常的情况

This commit is contained in:
gazebo
2019-05-30 18:24:22 +08:00
parent cfadf9b787
commit fb47383f42
6 changed files with 66 additions and 49 deletions

View File

@@ -195,7 +195,7 @@ func genSkuParamsFromStoreSkuInfo2(storeSku *dao.StoreSkuSyncInfo) (params map[s
func (p *PurchaseHandler) GetStoreSkusInfo(ctx *jxcontext.Context, parentTask tasksch.ITask, storeID int, vendorStoreID string, inStoreSkuList []*partner.BareStoreSkuInfo) (outStoreSkuList []*partner.BareStoreSkuInfo, err error) {
vendorSkuIDIntList := partner.BareStoreSkuInfoList(inStoreSkuList).GetVendorSkuIDIntList()
var vendorSkuList []*ebaiapi.SkuInfo
if len(inStoreSkuList) > 1 {
if len(vendorSkuIDIntList) > 1 {
task := tasksch.NewParallelTask("获取饿百平台门店商品信息", nil, ctx,
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
vendorSkuID := batchItemList[0].(int64)
@@ -210,13 +210,15 @@ func (p *PurchaseHandler) GetStoreSkusInfo(ctx *jxcontext.Context, parentTask ta
}, vendorSkuIDIntList)
tasksch.HandleTask(task, parentTask, false).Run()
_, err = task.GetResult(0)
} else {
} else if len(vendorSkuIDIntList) == 1 {
skuInfo, err2 := api.EbaiAPI.SkuList(utils.Int2Str(storeID), &ebaiapi.SkuListParams{
SkuID: utils.Str2Int64(inStoreSkuList[0].VendorSkuID),
SkuID: vendorSkuIDIntList[0],
})
if err = err2; err == nil {
vendorSkuList = skuInfo.List
}
} else {
return nil, nil
}
if err == nil {
storeSkuMap := make(map[int64]*partner.BareStoreSkuInfo)
@@ -225,10 +227,11 @@ func (p *PurchaseHandler) GetStoreSkusInfo(ctx *jxcontext.Context, parentTask ta
}
for _, skuInfo := range vendorSkuList {
storeSku := storeSkuMap[skuInfo.SkuID]
globals.SugarLogger.Debug(utils.Format4Output(storeSku, false))
outStoreSkuList = append(outStoreSkuList, storeSku)
storeSku.Price = skuInfo.SalePrice
storeSku.Status = ebaiSkuStatus2Jx(skuInfo.Status)
}
outStoreSkuList = inStoreSkuList
}
return outStoreSkuList, err
}