mirror of
https://github.com/v2board/v2board.git
synced 2025-06-12 20:47:56 +08:00
add balance payment
This commit is contained in:
@ -14,20 +14,23 @@ class OrderService
|
||||
$this->order = $order;
|
||||
}
|
||||
|
||||
public function cancel():void
|
||||
public function cancel():bool
|
||||
{
|
||||
$order = $this->order;
|
||||
DB::beginTransaction();
|
||||
$order->status = 2;
|
||||
if (!$order->save()) {
|
||||
DB::rollBack();
|
||||
return false;
|
||||
}
|
||||
if ($order->balance_amount) {
|
||||
$userService = new UserService();
|
||||
if (!$userService->addBalance($order->user_id, $order->balance_amount)) {
|
||||
DB::rollBack();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
DB::commit();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user