2023-09-18 09:11:13 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace app\adminapi\logic\user;
|
|
|
|
|
|
|
|
use app\common\logic\BaseLogic;
|
|
|
|
use app\common\model\user\User;
|
|
|
|
|
|
|
|
class UserLogic extends BaseLogic
|
|
|
|
{
|
|
|
|
//用户详情
|
|
|
|
public static function detail(int $userId): array
|
|
|
|
{
|
2023-09-19 15:39:19 +08:00
|
|
|
$field = ['id','phone','avatar','nick_name','real_name','id_card','gender','age','total_balance','total_integral','province','city','area','street','village','brigade','address','status','last_login_time','last_login_ip','create_time'];
|
2023-09-18 09:11:13 +08:00
|
|
|
$user = User::field($field)->where(['id' => $userId])->findOrEmpty();
|
2023-09-19 15:39:19 +08:00
|
|
|
$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;
|
|
|
|
unset($user['province'],$user['city'],$user['area'],$user['street'],$user['village'],$user['brigade']);
|
2023-09-18 09:11:13 +08:00
|
|
|
return $user->toArray();
|
|
|
|
}
|
|
|
|
}
|