data_center/app/adminapi/logic/user/UserLogic.php

21 lines
957 B
PHP

<?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
{
$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'];
$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;
unset($user['province'],$user['city'],$user['area'],$user['street'],$user['village'],$user['brigade']);
return $user->toArray();
}
}