京西折扣

This commit is contained in:
苏尹岚
2020-08-12 10:42:27 +08:00
parent 7201caec7c
commit 96a407d218

View File

@@ -1587,6 +1587,27 @@ func ChangeJxPriceByDiscountAct(ctx *jxcontext.Context) {
}
} else { //第二档时间内
pricePercentage = 0.1
actualPricePercentage = float64(actStoreSku.OriginalPrice) * (float64(1) - pricePercentage)
//判断活动的折扣类型是最低价还是最低折扣
if act.DiscountType == model.ActDiscountTypePrice {
minJxPrice = int64(act.DiscountValue2)
} else if act.DiscountType == model.ActDiscountTypePercentage {
minJxPrice = actStoreSku.OriginalPrice * int64(act.DiscountValue2) / 100
}
if storeSku.JxPrice == int(minJxPrice) {
actStoreSku.TrendType = model.TrendTypeNothing
} else {
actStoreSku.TrendType = model.TrendTypeDown
}
if _, err = dao.UpdateEntity(db, actStoreSku, "TrendType"); err != nil {
dao.Rollback(db)
}
if utils.Float64TwoInt64(float64(storeSku.JxPrice)*actualPricePercentage) <= minJxPrice {
storeSku.JxPrice = int(minJxPrice)
}
if _, err = dao.UpdateEntity(db, storeSku, "JxPrice"); err != nil {
dao.Rollback(db)
}
}
dao.Commit(db)
}