降价时没得守价不变库存
This commit is contained in:
@@ -1572,7 +1572,13 @@ func ChangeJxPriceByDiscountAct(ctx *jxcontext.Context) {
|
|||||||
storeSku.JxPrice = storeSku.JxPrice + int(actualPrice)
|
storeSku.JxPrice = storeSku.JxPrice + int(actualPrice)
|
||||||
} else if actStoreSku.TrendType == model.TrendTypeDown {
|
} else if actStoreSku.TrendType == model.TrendTypeDown {
|
||||||
storeSku.JxPrice = storeSku.JxPrice - int(actualPrice)
|
storeSku.JxPrice = storeSku.JxPrice - int(actualPrice)
|
||||||
storeSku.Stock = checkPriceDefendOrderByPrice(db, storeSku.StoreID, storeSku.SkuID, storeSku.Stock, storeSku.JxPrice)
|
stock := checkPriceDefendOrderByPrice(db, storeSku.StoreID, storeSku.SkuID, storeSku.Stock, storeSku.JxPrice)
|
||||||
|
if stock != -1 {
|
||||||
|
storeSku.Stock = stock
|
||||||
|
if _, err = dao.UpdateEntity(db, storeSku, "Stock"); err != nil {
|
||||||
|
dao.Rollback(db)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if storeSku.JxPrice >= int(actStoreSku.OriginalPrice) {
|
if storeSku.JxPrice >= int(actStoreSku.OriginalPrice) {
|
||||||
storeSku.JxPrice = int(actStoreSku.OriginalPrice)
|
storeSku.JxPrice = int(actStoreSku.OriginalPrice)
|
||||||
@@ -1586,7 +1592,7 @@ func ChangeJxPriceByDiscountAct(ctx *jxcontext.Context) {
|
|||||||
if storeSku.JxPrice <= int(minJxPrice) {
|
if storeSku.JxPrice <= int(minJxPrice) {
|
||||||
storeSku.JxPrice = int(minJxPrice)
|
storeSku.JxPrice = int(minJxPrice)
|
||||||
}
|
}
|
||||||
if _, err = dao.UpdateEntity(db, storeSku, "JxPrice", "Stock"); err != nil {
|
if _, err = dao.UpdateEntity(db, storeSku, "JxPrice"); err != nil {
|
||||||
dao.Rollback(db)
|
dao.Rollback(db)
|
||||||
}
|
}
|
||||||
//C >= 2N 涨价趋势,最高涨价到无折扣
|
//C >= 2N 涨价趋势,最高涨价到无折扣
|
||||||
@@ -1635,7 +1641,7 @@ func ChangeJxPriceByDiscountAct(ctx *jxcontext.Context) {
|
|||||||
func checkPriceDefendOrderByPrice(db *dao.DaoDB, storeID, skuID, stock, jxPrice int) (realStock int) {
|
func checkPriceDefendOrderByPrice(db *dao.DaoDB, storeID, skuID, stock, jxPrice int) (realStock int) {
|
||||||
priceDefends, _ := dao.GetPriceDefendOrder(db, []int{storeID}, []int{skuID}, []int{jxutils.GetDefendPriceIssue()}, 0, 0, 0)
|
priceDefends, _ := dao.GetPriceDefendOrder(db, []int{storeID}, []int{skuID}, []int{jxutils.GetDefendPriceIssue()}, 0, 0, 0)
|
||||||
if len(priceDefends) == 0 {
|
if len(priceDefends) == 0 {
|
||||||
return
|
return -1
|
||||||
}
|
}
|
||||||
for _, v := range priceDefends {
|
for _, v := range priceDefends {
|
||||||
//如果刚好守的价和降的价一样,再判断库存够不够
|
//如果刚好守的价和降的价一样,再判断库存够不够
|
||||||
|
|||||||
Reference in New Issue
Block a user