删除旧的活动规则校验
This commit is contained in:
@@ -21,11 +21,6 @@ import (
|
||||
|
||||
const (
|
||||
DefActSkuStock = 200 // 缺省活动库存
|
||||
|
||||
maxDiscount4SkuSecKill = 80
|
||||
maxDiscount4Sku = 99
|
||||
minDiscount4SkuDirectDown = 0
|
||||
minDiscount4SkuDirectDownMTWM = 30
|
||||
)
|
||||
|
||||
type ActOrderRuleParam struct {
|
||||
@@ -369,27 +364,6 @@ func AddActStoreSkuBind(ctx *jxcontext.Context, db *dao.DaoDB, actID int, actSto
|
||||
return err
|
||||
}
|
||||
|
||||
// func checkDiscountValidation(vendorIDs []int, actType int, pricePercentage float64) (err error) {
|
||||
// pricePercentageMin := int(math.Floor(pricePercentage))
|
||||
// pricePercentageMax := int(math.Ceil(pricePercentage))
|
||||
// if actType == model.ActSkuDirectDown && (pricePercentageMin < minDiscount4SkuDirectDown || pricePercentageMax > 99) {
|
||||
// if pricePercentageMin < minDiscount4SkuDirectDown {
|
||||
// err = fmt.Errorf("%s活动折扣必须大于:%d", model.ActTypeName[actType], minDiscount4SkuDirectDown)
|
||||
// } else if pricePercentageMax > maxDiscount4Sku {
|
||||
// err = fmt.Errorf("%s活动必须至少有%d折扣", model.ActTypeName[actType], maxDiscount4Sku)
|
||||
// } else if len(vendorIDs) > 0 && vendorIDs[0] == model.VendorIDMTWM && pricePercentageMin < minDiscount4SkuDirectDownMTWM {
|
||||
// err = fmt.Errorf("美团平台%s活动折扣必须大于:%d", model.ActTypeName[actType], minDiscount4SkuDirectDownMTWM)
|
||||
// }
|
||||
// } else if actType == model.ActSkuSecKill {
|
||||
// if len(vendorIDs) > 0 && vendorIDs[0] == model.VendorIDMTWM && pricePercentageMax > minDiscount4SkuDirectDownMTWM {
|
||||
// err = fmt.Errorf("美团平台%s活动折扣必须小于:%d", model.ActTypeName[actType], minDiscount4SkuDirectDownMTWM)
|
||||
// } else if pricePercentageMax > maxDiscount4SkuSecKill {
|
||||
// err = fmt.Errorf("%s活动折扣必须小于:%d", model.ActTypeName[actType], maxDiscount4SkuSecKill)
|
||||
// }
|
||||
// }
|
||||
// return err
|
||||
// }
|
||||
|
||||
func getActRule(vendorID, actType int) (actRule *tActRuleInfo, err error) {
|
||||
if actRuleMap[vendorID] != nil {
|
||||
actRule = actRuleMap[vendorID][actType]
|
||||
@@ -1047,6 +1021,7 @@ func ForceUpdateVendorPrice(ctx *jxcontext.Context, vendorID int, actType int, s
|
||||
var wrongSkuList []*ActStoreSkuParam
|
||||
var storeSkuBindList []*model.StoreSkuBind
|
||||
|
||||
actRule, _ := getActRule(vendorID, actType)
|
||||
db := dao.GetDB()
|
||||
errList := errlist.New()
|
||||
for _, v := range storeSkuList {
|
||||
@@ -1067,11 +1042,7 @@ func ForceUpdateVendorPrice(ctx *jxcontext.Context, vendorID int, actType int, s
|
||||
} else {
|
||||
vendorPrice = dao.GetStoreSkuBindVendorPrice(storeSkuBind, vendorID)
|
||||
if checkDiscountValidation([]int{vendorID}, actType, float64(v.ActPrice)*100/float64(vendorPrice)) != nil {
|
||||
if actType == model.ActSkuSecKill {
|
||||
vendorPrice = int(v.ActPrice)*100/maxDiscount4SkuSecKill + 10
|
||||
} else if actType == model.ActSkuDirectDown {
|
||||
vendorPrice = int(v.ActPrice) + 10
|
||||
}
|
||||
vendorPrice = int(v.ActPrice)*100/actRule.MaxDiscount + 10
|
||||
} else {
|
||||
storeSkuBind = nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user