- 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

@@ -207,7 +207,7 @@ func (p *PurchaseHandler) UpdateStoreSkusPrice(ctx *jxcontext.Context, storeID i
func (p *PurchaseHandler) GetStoreSkusInfo(ctx *jxcontext.Context, parentTask tasksch.ITask, storeID int, vendorStoreID string, inStoreSkuList []*partner.BareStoreSkuInfo) (outStoreSkuList []*partner.BareStoreSkuInfo, err error) {
vendorSkuIDList := partner.BareStoreSkuInfoList(inStoreSkuList).GetVendorSkuIDList()
var vendorFoodList []*mtwmapi.AppFood
if len(inStoreSkuList) > 1 {
if len(vendorSkuIDList) > 1 {
task := tasksch.NewParallelTask("获取饿百平台门店商品信息", nil, ctx,
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
vendorSkuID := batchItemList[0].(string)
@@ -220,11 +220,13 @@ func (p *PurchaseHandler) GetStoreSkusInfo(ctx *jxcontext.Context, parentTask ta
}, vendorSkuIDList)
tasksch.HandleTask(task, parentTask, false).Run()
_, err = task.GetResult(0)
} else {
skuInfo, err2 := api.MtwmAPI.RetailGet(vendorStoreID, inStoreSkuList[0].VendorSkuID)
} else if len(vendorSkuIDList) == 1 {
skuInfo, err2 := api.MtwmAPI.RetailGet(vendorStoreID, vendorSkuIDList[0])
if err = err2; err == nil {
vendorFoodList = []*mtwmapi.AppFood{skuInfo}
}
} else {
return nil, nil
}
if err == nil {
storeSkuMap := make(map[string]*partner.BareStoreSkuInfo)
@@ -234,10 +236,10 @@ func (p *PurchaseHandler) GetStoreSkusInfo(ctx *jxcontext.Context, parentTask ta
for _, foodInfo := range vendorFoodList {
vendorSku := foodInfo.SkuList[0]
storeSku := storeSkuMap[vendorSku.SkuID]
outStoreSkuList = append(outStoreSkuList, storeSku)
storeSku.Price = jxutils.StandardPrice2Int(utils.Str2Float64WithDefault(vendorSku.Price, 0))
storeSku.Status = mtwmSkuStatus2Jx(foodInfo.IsSoldOut)
}
outStoreSkuList = inStoreSkuList
}
return outStoreSkuList, err
}