From 9c0e0e71a2468b3160ce46208563a620868b4ccb 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, 21 Aug 2020 10:10:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=80=E4=BD=8E=E4=BB=B7=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/act/act.go | 1 - business/model/act.go | 5 ++++- business/model/dao/act.go | 2 +- business/model/dao/store_sku.go | 12 +++++++++--- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/business/jxstore/act/act.go b/business/jxstore/act/act.go index 718180362..48344d6a4 100644 --- a/business/jxstore/act/act.go +++ b/business/jxstore/act/act.go @@ -424,7 +424,6 @@ func getActRule(vendorID, actType int) (actRule *tActRuleInfo, err error) { func checkDiscountValidation(vendorIDs []int, actType int, pricePercentage float64) (err error) { pricePercentageMin := int(math.Floor(pricePercentage)) pricePercentageMax := int(math.Ceil(pricePercentage)) - fmt.Println(pricePercentageMin, pricePercentageMax, pricePercentage) errList := errlist.New() for _, vendorID := range vendorIDs { actRule, err2 := getActRule(vendorID, actType) diff --git a/business/model/act.go b/business/model/act.go index 1c8183ae9..2eb89d230 100644 --- a/business/model/act.go +++ b/business/model/act.go @@ -203,7 +203,10 @@ func (*ActStoreSkuMap) TableIndex() [][]string { type ActStoreSku2 struct { MapID int `orm:"column(map_id)"` - Type int `json:"type"` + Type int `json:"type"` + DiscountType int `json:"discountType"` + DiscountValue1 int `json:"discountValue1"` + DiscountValue2 int `json:"discountValue2"` ActStoreSku VendorID int `orm:"column(vendor_id)" json:"vendorID"` diff --git a/business/model/dao/act.go b/business/model/dao/act.go index 81a03511d..a40220d8d 100644 --- a/business/model/dao/act.go +++ b/business/model/dao/act.go @@ -373,7 +373,7 @@ func GetEffectiveActStoreSkuInfo(db *DaoDB, actID int, vendorIDs []int, actType } sql := ` SELECT - t1.type, + t1.type, t1.discount_type, t1.discount_value1, t1.discount_value2, t2.*, t3.actual_act_price, t3.sync_status, t3.vendor_price, t3.vendor_id, t3.trend_type, t3.trend_price FROM act t1 diff --git a/business/model/dao/store_sku.go b/business/model/dao/store_sku.go index 5d05196a7..48f17b452 100644 --- a/business/model/dao/store_sku.go +++ b/business/model/dao/store_sku.go @@ -260,9 +260,12 @@ type StoreSkuExt struct { JxLockTime *time.Time `orm:"null" json:"jxLockTime,omitempty"` YbLockTime *time.Time `orm:"null" json:"ybLockTime,omitempty"` - ActPrice int `json:"actPrice"` - ActID int `orm:"column(act_id)" json:"actID"` - ActType int `orm:"column(act_type)" json:"actType"` + ActPrice int `json:"actPrice"` + ActID int `orm:"column(act_id)" json:"actID"` + ActType int `orm:"column(act_type)" json:"actType"` + DiscountType int `json:"discountType"` + DiscountValue1 int `json:"discountValue1"` + DiscountValue2 int `json:"discountValue2"` EarningPrice int `json:"earningPrice"` EarningActID int `orm:"column(earning_act_id)" json:"earningActID"` @@ -1370,6 +1373,9 @@ func UpdateActPrice4StoreSkuNameNew(db *DaoDB, storeIDs, skuIDs []int, skuNamesI v.EarningPrice = int(jxutils.CaculateSkuEarningPrice(int64(v.BindPrice), int64(v.ActPrice), skuName.PayPercentage)) v.TrendType = actStoreSku.TrendType v.TrendPrice = actStoreSku.TrendPrice + v.DiscountType = actStoreSku.DiscountType + v.DiscountValue1 = actStoreSku.DiscountValue1 + v.DiscountValue2 = actStoreSku.DiscountValue2 } if actStoreSku := actStoreSkuMap4EarningPrice.GetActStoreSku(skuName.StoreID, v.SkuID, -1); actStoreSku != nil { v.EarningPrice = int(actStoreSku.EarningPrice)