From 34759f564bfd8c8c22433ee7db999fe461c44c63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 22 Nov 2019 16:59:31 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BB=E5=8F=96=E6=B0=B8=E8=BE=89Excel?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/yonghui/yonghui.go | 44 ++++++++++++++--------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/business/jxstore/yonghui/yonghui.go b/business/jxstore/yonghui/yonghui.go index 1ae1454d7..512ea0244 100644 --- a/business/jxstore/yonghui/yonghui.go +++ b/business/jxstore/yonghui/yonghui.go @@ -274,27 +274,7 @@ func LoadExcelBinByYongHui(ctx *jxcontext.Context, reader io.Reader, isAsync, is } else { costPrice = skuMap[spuCode].Price } - _, _, err = updateWeiMobGoods(costPrice, skuMap[spuCode].Price, isCompare, goodsDetail) - if err != nil { - if errExt, ok := err.(*utils.ErrorWithCode); ok { - outPutData := DataFailed{ - GoodsID: spuCode, - GoodsName: skuMap[spuCode].Name, - Comment: errExt.ErrMsg(), - } - dataFailed.AppendData2(outPutData) - } - } else { - outPutData := DataSuccess{ - NameID: goodsDetail.SkuMap.SingleSku.OuterSkuCode, - Name: goodsDetail.Title, - Unit: skuList[0].Unit, - OrgPrice: goodsDetail.SkuMap.SingleSku.SalePrice, - NowPrice: skuMap[spuCode].Price, - MixPrice: Float64Round(skuMap[spuCode].Price - goodsDetail.SkuMap.SingleSku.SalePrice), - } - dataSuccess.AppendData(outPutData) - } + _, _, _ = updateWeiMobGoods(costPrice, skuMap[spuCode].Price, skuList[0].Unit, isCompare, goodsDetail) } } else { //下架微盟商品 @@ -371,7 +351,7 @@ func GetGoodsInfoAndDetailMap(goodsList []*weimobapi.GoodsInfo) (goodsMap map[st // return list // } -func updateWeiMobGoods(costPrice, salePrice float64, isCompare bool, goodsDetail *weimobapi.GoodsDetailInfo) (goodsID int64, skuMap map[string]int64, err error) { +func updateWeiMobGoods(costPrice, salePrice float64, unit string, isCompare bool, goodsDetail *weimobapi.GoodsDetailInfo) (goodsID int64, skuMap map[string]int64, err error) { var ( categoryList []*weimobapi.CategoryList skuListInfo = goodsDetail.SkuList[0] @@ -486,6 +466,26 @@ func updateWeiMobGoods(costPrice, salePrice float64, isCompare bool, goodsDetail } if globals.EnableStoreWrite { goodsID, skuMap, err = api.WeimobAPI.UpdateGoods3(updateGoodsParam) + if err != nil { + if errExt, ok := err.(*utils.ErrorWithCode); ok { + outPutData := DataFailed{ + GoodsID: goodsDetail.OuterGoodsCode, + GoodsName: goodsDetail.Title, + Comment: errExt.ErrMsg(), + } + dataFailed.AppendData2(outPutData) + } + } else { + outPutData := DataSuccess{ + NameID: goodsDetail.SkuMap.SingleSku.OuterSkuCode, + Name: goodsDetail.Title, + Unit: unit, + OrgPrice: goodsDetail.SkuMap.SingleSku.SalePrice, + NowPrice: salePrice, + MixPrice: Float64Round(salePrice - goodsDetail.SkuMap.SingleSku.SalePrice), + } + dataSuccess.AppendData(outPutData) + } } return goodsID, skuMap, err }