From 6bcdc0f09d9d4dcf5bc60815ab12fdc9bc8b5da1 Mon Sep 17 00:00:00 2001 From: luofei <604446095@qq.com> Date: Fri, 15 Mar 2024 11:15:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=A8=E6=88=B7=E9=82=80?= =?UTF-8?q?=E8=AF=B7=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/api/user/User.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/controller/api/user/User.php b/app/controller/api/user/User.php index d2f5084d..54f83a89 100644 --- a/app/controller/api/user/User.php +++ b/app/controller/api/user/User.php @@ -553,9 +553,10 @@ class User extends BaseController public function merchantRecord() { [$page, $limit] = $this->getPage(); - $userIds = UserModel::where('spread_uid', $this->user->uid)->page($page, $limit)->column('uid'); - $query = Merchant::whereIn('uid', $userIds)->where('is_del', 0); - $merchants = $query->page($page, $limit) + $userQuery = UserModel::where('spread_uid', $this->user->uid); + $count = $userQuery->count(); + $userIds = $userQuery->page($page, $limit)->column('uid'); + $merchants = Merchant::whereIn('uid', $userIds)->where('is_del', 0) ->field('mer_id,mer_name,uid,real_name,sale_amount,purchase_amount as buy_amount') ->select()->toArray(); $merchants = reset_index($merchants, 'uid'); @@ -569,7 +570,7 @@ class User extends BaseController $result[] = ['mer_id' => '', 'mer_name' => '', 'uid' => $userId, 'real_name' => '', 'sale_amount' => '0.00', 'buy_amount' => '0.00', 'status' => 0]; } } - return app('json')->success(['count' => count($userIds), 'list' => $result]); + return app('json')->success(['count' => $count, 'list' => $result]); } /**