mirror of
https://github.com/v2board/v2board.git
synced 2024-11-10 09:39:10 +08:00
fix: change plan refund surplus amount
This commit is contained in:
parent
4d38ce3968
commit
88948eb8ee
@ -202,7 +202,7 @@ class OrderService
|
||||
if ($item->cycle === 'onetime_price') continue;
|
||||
if ($this->orderIsUsed($item)) continue;
|
||||
$orderSurplusMonth = $orderSurplusMonth + self::STR_TO_TIME[$item->cycle];
|
||||
$orderSurplusAmount = $orderSurplusAmount + ($item['total_amount'] + $item['balance_amount']);
|
||||
$orderSurplusAmount = $orderSurplusAmount + ($item['total_amount'] + $item['balance_amount'] + $item['surplus_amount']);
|
||||
}
|
||||
if (!$orderSurplusMonth || !$orderSurplusAmount) return;
|
||||
$monthUnitPrice = $orderSurplusAmount / $orderSurplusMonth;
|
||||
|
@ -55,7 +55,7 @@ class UserService
|
||||
|
||||
public function addBalance(int $userId, int $balance):bool
|
||||
{
|
||||
$user = User::find($userId);
|
||||
$user = User::lockForUpdate()->find($userId);
|
||||
if (!$user) {
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user