diff --git a/business/jxstore/yonghui/yonghui.go b/business/jxstore/yonghui/yonghui.go index c4443afd9..3087d3209 100644 --- a/business/jxstore/yonghui/yonghui.go +++ b/business/jxstore/yonghui/yonghui.go @@ -771,6 +771,7 @@ func UpdateJxPriceByWeimob(ctx *jxcontext.Context, storeIDs []int, isAsync, isCo var ( storeSkuBindInfoList []interface{} skuBindInfos []*cms.StoreSkuBindInfo + nameID int ) db := dao.GetDB() dataFailed.dataFailedList = dataFailed.dataFailedList[0:0] @@ -793,9 +794,19 @@ func UpdateJxPriceByWeimob(ctx *jxcontext.Context, storeIDs []int, isAsync, isCo if err != nil { baseapi.SugarLogger.Errorf("QueryGoodsDetail error:%v", err) } - nameID := int(utils.Str2Int64(goodsDetail.SkuMap.SingleSku.OuterSkuCode)) - unitPrice := int(utils.Float64TwoInt64(goodsDetail.SkuMap.SingleSku.CostPrice * 100)) goodsID := goodsDetail.OuterGoodsCode + unitPrice := int(utils.Float64TwoInt64(goodsDetail.SkuMap.SingleSku.CostPrice * 100)) + if goodsDetail.SkuMap.SingleSku.OuterSkuCode != "" { + nameID = int(utils.Str2Int64(goodsDetail.SkuMap.SingleSku.OuterSkuCode)) + } else { + outPutData := DataFailed{ + GoodsID: goodsID, + GoodsName: goodsDetail.Title, + Comment: "微盟上没有该商品的商品编码", + } + dataFailed.AppendData2(outPutData) + nameID = -1 + } skuList, err := dao.GetStoreSkusByNameIDs(db, storeIDs, nameID) if len(skuList) > 0 { if goodsDetail.OuterGoodsCode != "" {