From 99da2e9824b75e4bdff8f5e4238fb1c6ea26a1b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 12 Dec 2019 14:40:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B9=E6=8D=AEexcel=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E4=BA=AC=E8=A5=BF=E4=BB=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 055240308..89b2338e3 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -2193,8 +2193,8 @@ func RefreshJxPriceByExcelBin(ctx *jxcontext.Context, storeIDs []int, reader io. taskSeqFunc := func(task *tasksch.SeqTask, step int, params ...interface{}) (result interface{}, err error) { switch step { case 0: - // xlsx, err := excelize.OpenFile("111.xlsx") xlsx, err := excelize.OpenReader(reader) + // xlsx, err := excelize.OpenFile("111.xlsx") if err != nil { return "", err } @@ -2229,9 +2229,15 @@ func RefreshJxPriceByExcelBin(ctx *jxcontext.Context, storeIDs []int, reader io. skuList, err2 := dao.GetStoreSkusByNameIDs(db, []int{vv}, nameID) err = err2 if len(skuList) > 0 { + unitPrice := 0 + if storeSkuNamePrice.Unit == "KG" { + unitPrice = storeSkuNamePrice.Price / 2 + } else { + unitPrice = storeSkuNamePrice.Price + } storeSkuBindInfo := &StoreSkuBindInfo{ NameID: nameID, - UnitPrice: storeSkuNamePrice.Price, + UnitPrice: unitPrice, } skuBindInfos = append(skuBindInfos, storeSkuBindInfo) outSuccess := DataSuccess{ @@ -2239,8 +2245,8 @@ func RefreshJxPriceByExcelBin(ctx *jxcontext.Context, storeIDs []int, reader io. Name: skuList[0].Name, Unit: storeSkuNamePrice.Unit, OrgPrice: utils.Str2Float64(utils.Int64ToStr(skuList[0].UnitPrice / 100)), - NowPrice: utils.Str2Float64(utils.Int64ToStr(int64(storeSkuNamePrice.Price / 100))), - MixPrice: utils.Str2Float64(utils.Int64ToStr(int64(storeSkuNamePrice.Price) - skuList[0].UnitPrice)), + NowPrice: utils.Str2Float64(utils.Int64ToStr(int64(unitPrice / 100))), + MixPrice: utils.Str2Float64(utils.Int64ToStr(int64(unitPrice) - skuList[0].UnitPrice)), } dataLock.AppendDataSuccess(outSuccess) } else {