- 活动出错信息返回最终的活动价
This commit is contained in:
@@ -32,7 +32,9 @@ type ActOrderRuleParam struct {
|
||||
|
||||
type ActStoreSkuParam struct {
|
||||
model.ActStoreSku
|
||||
ErrMsg string `json:"errMsg"`
|
||||
|
||||
ActualActPrice int64 `json:"actualActPrice,omitempty"` // 单品级活动用,创建活动时商品的活动价格
|
||||
ErrMsg string `json:"errMsg,omitempty"`
|
||||
}
|
||||
|
||||
type ActDetail struct {
|
||||
@@ -153,6 +155,7 @@ func ActStoreSkuParam2Model(ctx *jxcontext.Context, db *dao.DaoDB, act *model.Ac
|
||||
}
|
||||
if err2 := checkDiscountValidation(act.Type, int(actSkuMap.ActualActPrice*100/actSkuMap.VendorPrice)); err2 != nil {
|
||||
v.ErrMsg = err2.Error()
|
||||
v.ActualActPrice = actSkuMap.ActualActPrice
|
||||
wrongSkuList = append(wrongSkuList, v)
|
||||
} else {
|
||||
dao.WrapAddIDCULDEntity(actSkuMap, ctx.GetUserName())
|
||||
@@ -275,7 +278,11 @@ func AddActStoreSkuBind(ctx *jxcontext.Context, db *dao.DaoDB, actID int, actSto
|
||||
|
||||
func checkDiscountValidation(actType int, pricePercentage int) (err error) {
|
||||
if actType == model.ActSkuDirectDown && (pricePercentage < minDiscount4SkuDirectDown || pricePercentage > 99) {
|
||||
err = fmt.Errorf("%s活动折扣必须大于:%d, 且必须有折扣", model.ActTypeName[actType], minDiscount4SkuDirectDown)
|
||||
if pricePercentage < minDiscount4SkuDirectDown {
|
||||
err = fmt.Errorf("%s活动折扣必须大于:%d", model.ActTypeName[actType], minDiscount4SkuDirectDown)
|
||||
} else if pricePercentage > 99 {
|
||||
err = fmt.Errorf("%s活动必须有折扣", model.ActTypeName[actType])
|
||||
}
|
||||
} else if actType == model.ActSkuSecKill && pricePercentage > maxDiscount4SkuSecKill {
|
||||
err = fmt.Errorf("%s活动折扣必须小于:%d", model.ActTypeName[actType], maxDiscount4SkuSecKill)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user