소스 검색

add balance payment

Tokumeikoi 5 년 전
부모
커밋
3075f0d411
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      app/Http/Controllers/User/OrderController.php

+ 2 - 2
app/Http/Controllers/User/OrderController.php

@@ -222,14 +222,14 @@ class OrderController extends Controller
             $remainingBalance = $user->balance - $order->total_amount;
             $userService = new UserService();
             if ($remainingBalance > 0) {
-                if (!$userService->addBalance($order->user_id, $order->total_amount)) {
+                if (!$userService->addBalance($order->user_id, - $order->total_amount)) {
                     DB::rollBack();
                     abort(500, '余额不足');
                 }
                 $order->balance_amount = $order->total_amount;
                 $order->total_amount = 0;
             } else {
-                if (!$userService->addBalance($order->user_id, $user->balance)) {
+                if (!$userService->addBalance($order->user_id, - $user->balance)) {
                     DB::rollBack();
                     abort(500, '余额不足');
                 }