Kirin 3 лет назад
Родитель
Сommit
717637f6dc
2 измененных файлов с 8 добавлено и 8 удалено
  1. 4 4
      app/api/controller/user/UserBillController.php
  2. 4 4
      app/models/user/UserBill.php

+ 4 - 4
app/api/controller/user/UserBillController.php

@@ -347,8 +347,8 @@ class UserBillController
             ['page', 0], ['limit', 0], ['pm', 1]
         ], $request, true);
         $list = UserBill::userBillList($request->uid(), $page, $limit, 'integral', $pm);
-        $income = UserBill::where('category', 'integral')->where('pm', 1)->where('status', 1)->sum('number');
-        $expend = UserBill::where('category', 'integral')->where('pm', 0)->where('status', 1)->sum('number');
+        $income = UserBill::where('uid', $request->uid())->where('category', 'integral')->where('pm', 1)->where('status', 1)->sum('number');
+        $expend = UserBill::where('uid', $request->uid())->where('category', 'integral')->where('pm', 0)->where('status', 1)->sum('number');
         return app('json')->success('ok', compact('list', 'income', 'expend'));
 
     }
@@ -359,8 +359,8 @@ class UserBillController
             ['page', 0], ['limit', 0], ['pm', 1]
         ], $request, true);
         $list = UserBill::userBillList($request->uid(), $page, $limit, 'cash', $pm);
-        $income = UserBill::where('category', 'cash')->where('pm', 1)->where('status', 1)->sum('number');
-        $expend = UserBill::where('category', 'cash')->where('pm', 0)->where('status', 1)->sum('number');
+        $income = UserBill::where('uid', $request->uid())->where('category', 'cash')->where('pm', 1)->where('status', 1)->sum('number');
+        $expend = UserBill::where('uid', $request->uid())->where('category', 'cash')->where('pm', 0)->where('status', 1)->sum('number');
         return app('json')->success('ok', compact('list', 'income', 'expend'));
     }
 }

+ 4 - 4
app/models/user/UserBill.php

@@ -179,11 +179,11 @@ class UserBill extends BaseModel
             array_push($data, $value);
         }
         if (in_array($type, [1, 2])) {
-            $income = UserBill::where('category', 'now_money')->where('type', '<>', 'brokerage')->where('pm', 1)->where('status', 1)->sum('number');
-            $expend = UserBill::where('category', 'now_money')->where('type', '<>', 'brokerage')->where('pm', 0)->where('status', 1)->sum('number');
+            $income = UserBill::where('uid', $uid)->where('category', 'now_money')->where('type', '<>', 'brokerage')->where('pm', 1)->where('status', 1)->sum('number');
+            $expend = UserBill::where('uid', $uid)->where('category', 'now_money')->where('type', '<>', 'brokerage')->where('pm', 0)->where('status', 1)->sum('number');
         } else {
-            $income = UserBill::where('category', 'now_money')->where('type', 'brokerage')->where('pm', 1)->where('status', 1)->sum('number');
-            $expend = UserBill::where('category', 'now_money')->where('type', 'brokerage')->where('pm', 0)->where('status', 1)->sum('number');
+            $income = UserBill::where('uid', $uid)->where('category', 'now_money')->where('type', 'brokerage')->where('pm', 1)->where('status', 1)->sum('number');
+            $expend = UserBill::where('uid', $uid)->where('category', 'now_money')->where('type', 'brokerage')->where('pm', 0)->where('status', 1)->sum('number');
         }
         return [$data, $income, $expend];
     }