获取用户信息

This commit is contained in:
2025-07-18 14:07:04 +08:00
parent 4988129503
commit deb6a2db97
3 changed files with 39 additions and 0 deletions
+24
View File
@@ -3,6 +3,7 @@
namespace app\common\service;
use app\common\logic\UserLogic;
use app\crm\model\Country;
class UserService
{
@@ -38,6 +39,29 @@ class UserService
];
}
/**
* 获取用户信息(包括菜单和权限)
*/
public function getUser(int $uid)
{
$user = $this->logic->userInfo($uid);
return [
'id' => $user->id,
'name' => $user->name,
'position' => $user->position,
'socialize' => $user->socialize,
'socialize_pic' => $user->socialize_pic,
'country_id' => $user->country_id,
'country_txt' => Country::where('id',$user->country_id)->value('cn_addr'),
'avatar' => $user->avatar,
'phone' => $user->phone,
'email' => $user->email,
'status' => $user->status,
'roles' => $user->roles->pluck('name')
];
}
/**
* 获取用户信息(包括菜单和权限)
*/