8点后也要判断守价的
This commit is contained in:
@@ -1570,6 +1570,15 @@ func ChangeJxPriceByDiscountAct(ctx *jxcontext.Context) {
|
||||
// storeSku.JxPrice = storeSku.JxPrice + int(actualPrice)
|
||||
} else if actStoreSkuMap.TrendType == model.TrendTypeDown {
|
||||
actStoreSkuMap.ActualActPrice = actStoreSkuMap.ActualActPrice - actualPrice
|
||||
//判断活动的折扣类型是最低价还是最低折扣(第一档)
|
||||
if act.DiscountType == model.ActDiscountTypePrice {
|
||||
minJxPrice = int64(act.DiscountValue1)
|
||||
} else if act.DiscountType == model.ActDiscountTypePercentage {
|
||||
minJxPrice = actStoreSkuMap.VendorPrice * int64(act.DiscountValue1) / 100
|
||||
}
|
||||
if actStoreSkuMap.ActualActPrice <= minJxPrice {
|
||||
actStoreSkuMap.ActualActPrice = minJxPrice
|
||||
}
|
||||
// storeSku.JxPrice = storeSku.JxPrice - int(actualPrice)
|
||||
stock := checkPriceDefendOrderByPrice(db, storeSku.StoreID, storeSku.SkuID, storeSku.Stock, int(actStoreSkuMap.ActualActPrice))
|
||||
if stock != -1 {
|
||||
@@ -1582,15 +1591,6 @@ func ChangeJxPriceByDiscountAct(ctx *jxcontext.Context) {
|
||||
if actStoreSkuMap.ActualActPrice >= actStoreSkuMap.VendorPrice {
|
||||
actStoreSkuMap.ActualActPrice = actStoreSkuMap.VendorPrice
|
||||
}
|
||||
//判断活动的折扣类型是最低价还是最低折扣(第一档)
|
||||
if act.DiscountType == model.ActDiscountTypePrice {
|
||||
minJxPrice = int64(act.DiscountValue1)
|
||||
} else if act.DiscountType == model.ActDiscountTypePercentage {
|
||||
minJxPrice = actStoreSkuMap.VendorPrice * int64(act.DiscountValue1) / 100
|
||||
}
|
||||
if actStoreSkuMap.ActualActPrice <= minJxPrice {
|
||||
actStoreSkuMap.ActualActPrice = minJxPrice
|
||||
}
|
||||
// if _, err = dao.UpdateEntity(db, actStoreSkuMap, "ActualActPrice"); err != nil {
|
||||
// dao.Rollback(db)
|
||||
// }
|
||||
@@ -1628,6 +1628,13 @@ func ChangeJxPriceByDiscountAct(ctx *jxcontext.Context) {
|
||||
if actStoreSkuMap.ActualActPrice <= minJxPrice {
|
||||
actStoreSkuMap.ActualActPrice = minJxPrice
|
||||
}
|
||||
stock := checkPriceDefendOrderByPrice(db, storeSku.StoreID, storeSku.SkuID, storeSku.Stock, int(actStoreSkuMap.ActualActPrice))
|
||||
if stock != -1 {
|
||||
storeSku.Stock = stock
|
||||
if _, err = dao.UpdateEntity(db, storeSku, "Stock"); err != nil {
|
||||
dao.Rollback(db)
|
||||
}
|
||||
}
|
||||
//22:00 恢复库存为100,价格恢复原价
|
||||
if time.Now().Hour() == 22 && time.Now().Minute() < 1 {
|
||||
storeSku.Stock = 100
|
||||
|
||||
Reference in New Issue
Block a user