处理红包使用的错误

This commit is contained in:
lewis 2024-01-22 00:50:22 +08:00
parent 4e264aef3c
commit de11c70461

View File

@ -574,22 +574,22 @@ class StoreOrderCreateRepository extends StoreOrderRepository
$a = bcdiv($pay_price, 6); $a = bcdiv($pay_price, 6);
if ($this->balance > $a) { if ($this->balance > $a) {
$pay_price = bcsub($pay_price, $a, 2); $pay_price = bcsub($pay_price, $a, 2);
$this->consumption_money = bcadd($this->consumption_money, $a); $this->consumption_money = bcadd($this->consumption_money, $a, 2);
$this->balance = bcsub($this->balance, $a); $this->balance = bcsub($this->balance, $a, 2);
} else { } else {
$pay_price = bcsub($pay_price, $this->balance, 2); $pay_price = bcsub($pay_price, $this->balance, 2);
$this->consumption_money = bcadd($this->consumption_money, $this->balance); $this->consumption_money = bcadd($this->consumption_money, $this->balance, 2);
$this->balance = 0; $this->balance = 0;
} }
} }
if ($this->store_consumption_user['type'] == 1) { if ($this->store_consumption_user['type'] == 1) {
if ($pay_price > $this->balance) { if ($pay_price > $this->balance) {
$pay_price = bcsub($pay_price, $this->balance, 2); $pay_price = bcsub($pay_price, $this->balance, 2);
$this->consumption_money = bcadd($this->consumption_money, $this->balance); $this->consumption_money = bcadd($this->consumption_money, $this->balance, 2);
$this->balance=0; $this->balance=0;
} else { } else {
$pay_price = 0; $pay_price = 0;
$this->consumption_money = bcadd($this->consumption_money, $pay_price); $this->consumption_money = bcadd($this->consumption_money, $pay_price, 2);
$this->balance = $pay_price; $this->balance = $pay_price;
} }