mirror of
				https://github.com/v2board/v2board.git
				synced 2025-10-31 17:31:49 +08:00 
			
		
		
		
	add balance payment
This commit is contained in:
		| @@ -222,14 +222,14 @@ class OrderController extends Controller | |||||||
|             $remainingBalance = $user->balance - $order->total_amount; |             $remainingBalance = $user->balance - $order->total_amount; | ||||||
|             $userService = new UserService(); |             $userService = new UserService(); | ||||||
|             if ($remainingBalance > 0) { |             if ($remainingBalance > 0) { | ||||||
|                 if (!$userService->addBalance($order->user_id, $order->total_amount)) { |                 if (!$userService->addBalance($order->user_id, - $order->total_amount)) { | ||||||
|                     DB::rollBack(); |                     DB::rollBack(); | ||||||
|                     abort(500, '余额不足'); |                     abort(500, '余额不足'); | ||||||
|                 } |                 } | ||||||
|                 $order->balance_amount = $order->total_amount; |                 $order->balance_amount = $order->total_amount; | ||||||
|                 $order->total_amount = 0; |                 $order->total_amount = 0; | ||||||
|             } else { |             } else { | ||||||
|                 if (!$userService->addBalance($order->user_id, $user->balance)) { |                 if (!$userService->addBalance($order->user_id, - $user->balance)) { | ||||||
|                     DB::rollBack(); |                     DB::rollBack(); | ||||||
|                     abort(500, '余额不足'); |                     abort(500, '余额不足'); | ||||||
|                 } |                 } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user