From 0114f078dddb60bf2d6a383f1659f14cfb7d9b42 Mon Sep 17 00:00:00 2001 From: gazebo Date: Fri, 31 May 2019 10:53:28 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E9=99=90=E5=88=B6=E9=97=A8=E5=BA=97?= =?UTF-8?q?=E4=BB=B7=E6=A0=BC=E6=9C=80=E5=A4=A7=E5=80=BC=E4=B8=BA1000?= =?UTF-8?q?=E5=85=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 054864a2d..9e5dd87d9 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -25,6 +25,8 @@ import ( ) const ( + MaxSkuUnitPrice = 100000 + CopyStoreSkuModeFresh = "fresh" CopyStoreSkuModeUpdate = "update" // CopyStoreSkuModeAdd = "add" @@ -71,6 +73,7 @@ type StoreSkuBindInfo struct { type tStoreSkuBindAndSpec struct { model.StoreSkuBind + Name string SpecQuality float32 SpecUnit string SkuNamePrice int @@ -580,7 +583,7 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, storeIDs []int, skuBind SELECT t2.*, t1.id real_sku_id, t1.spec_quality, t1.spec_unit, - t3.price sku_name_price, t3.unit sku_name_unit + t3.price sku_name_price, t3.unit sku_name_unit, t3.name FROM sku t1 JOIN store ts ON ts.id = ? AND ts.deleted_at = ? LEFT JOIN store_sku_bind t2 ON t2.sku_id = t1.id AND t2.store_id = ts.id AND t2.deleted_at = ? @@ -604,6 +607,10 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, storeIDs []int, skuBind } unitPrice := 0 if skuBindInfo.UnitPrice != 0 { + if skuBindInfo.UnitPrice > MaxSkuUnitPrice { + dao.Rollback(db) + return nil, fmt.Errorf("商品:%s价格:%s太夸张", allBinds[0].Name, jxutils.IntPrice2StandardCurrencyString(int64(skuBindInfo.UnitPrice))) + } unitPrice = skuBindInfo.UnitPrice } else { unitPrice = allBinds[0].UnitPrice