更新用户详情

This commit is contained in:
yaooo 2023-11-17 11:44:51 +08:00
parent c24910342a
commit a9da52bde7
2 changed files with 5 additions and 17 deletions

View File

@ -12,8 +12,8 @@ class UserLists extends BaseAdminDataLists implements ListsSearchInterface
public function setSearch(): array public function setSearch(): array
{ {
return [ return [
'=' => ['status','province','city','area','street','village','brigade'], '=' => ['status','phone'],
'%like%' => ['nickname','realname','phone'], '%like%' => ['nickname'],
]; ];
} }

View File

@ -7,6 +7,7 @@ use app\common\model\systems\System;
use app\common\model\user\User; use app\common\model\user\User;
use app\common\model\user\UserBalance; use app\common\model\user\UserBalance;
use app\common\model\user\UserIntegral; use app\common\model\user\UserIntegral;
use think\facade\Db;
class UserLogic extends BaseLogic class UserLogic extends BaseLogic
{ {
@ -14,24 +15,11 @@ class UserLogic extends BaseLogic
public static function detail(int $userId): array 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 = 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['gender_text'] = $user->gender_text;
$user['status_text'] = $user->status_text; $user['status_text'] = $user->status_text;
//获取用户余额列表 $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();
$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']);
return $user->toArray(); return $user->toArray();
} }