From a9da52bde77ca1bff5edac2bf4ec84e29c536fc6 Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Fri, 17 Nov 2023 11:44:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=94=A8=E6=88=B7=E8=AF=A6?= =?UTF-8?q?=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/adminapi/lists/user/UserLists.php | 4 ++-- app/adminapi/logic/user/UserLogic.php | 18 +++--------------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/app/adminapi/lists/user/UserLists.php b/app/adminapi/lists/user/UserLists.php index 584334a2..2dd9d66d 100644 --- a/app/adminapi/lists/user/UserLists.php +++ b/app/adminapi/lists/user/UserLists.php @@ -12,8 +12,8 @@ class UserLists extends BaseAdminDataLists implements ListsSearchInterface public function setSearch(): array { return [ - '=' => ['status','province','city','area','street','village','brigade'], - '%like%' => ['nickname','realname','phone'], + '=' => ['status','phone'], + '%like%' => ['nickname'], ]; } diff --git a/app/adminapi/logic/user/UserLogic.php b/app/adminapi/logic/user/UserLogic.php index 24e58e14..0cefca61 100644 --- a/app/adminapi/logic/user/UserLogic.php +++ b/app/adminapi/logic/user/UserLogic.php @@ -7,6 +7,7 @@ use app\common\model\systems\System; use app\common\model\user\User; use app\common\model\user\UserBalance; use app\common\model\user\UserIntegral; +use think\facade\Db; class UserLogic extends BaseLogic { @@ -14,24 +15,11 @@ class UserLogic extends BaseLogic public static function detail(int $userId): array { //获取用户信息 - $field = ['id','phone','avatar','nickname','realname','id_card','gender','age','total_balance','total_integral','province','city','area','street','village','brigade','address','status','last_login_time','last_login_ip','create_time']; + $field = ['id','phone','avatar','nickname','realname','status','gender','age','create_time']; $user = User::field($field)->where(['id' => $userId])->findOrEmpty(); - $user['address'] = $user->province_text.$user->city_text.$user->area_text.$user->street_text.$user->village_text.$user->brigade_text.$user->address; $user['gender_text'] = $user->gender_text; $user['status_text'] = $user->status_text; - //获取用户余额列表 - $user['balance_list'] = UserBalance::field('id,record_id,amount,total_amount,type,pay_type,mark,appid,create_time')->where('user_id',$userId)->limit(10)->order('create_time desc')->select()->each(function($item){ - $item['app'] = System::where('app_id',$item['appid'])->value('name'); - $item['type_text'] = $item->type_text; - $item['pay_type_text'] = $item->pay_type_text; - unset($item['appid']); - })->toArray(); - //获取用户积分列表 - $user['integral_list'] = UserIntegral::field('id,record_id,amount,total_amount,type,mark,appid,create_time')->where('user_id',$userId)->limit(10)->order('create_time desc')->select()->each(function($item){ - $item['app'] = System::where('app_id',$item['appid'])->value('name'); - $item['type_text'] = $item->type_text; - })->toArray(); - unset($user['province'],$user['city'],$user['area'],$user['street'],$user['village'],$user['brigade']); + $user['app_list'] = Db::name('system_user')->alias('su')->leftJoin('dc_system s','su.app_id = s.app_id')->field(['s.id', 's.app_id', 's.name'])->select(); return $user->toArray(); }