wip
This commit is contained in:
@@ -18,7 +18,6 @@ class AuthService
|
||||
->find();
|
||||
|
||||
|
||||
|
||||
if (!$user || !password_verify($password, $user['password'])) {
|
||||
throw new \Exception('用户名或密码错误');
|
||||
}
|
||||
@@ -31,13 +30,16 @@ class AuthService
|
||||
$userInfo = [
|
||||
'id' => $user['id'], // 用户ID
|
||||
'company_id' => $user['company_id'], // 所属公司ID
|
||||
'company_name' => $user['company']['company_name'], // 所属公司名称
|
||||
'company_name' => $user['role'] === 'client' && (bool) $user['can_view_all_tickets']
|
||||
? '全部客户'
|
||||
: ($user['company']['company_name'] ?? ''), // 所属公司名称
|
||||
'username' => $user['username'],
|
||||
'role' => $user['role'],
|
||||
'can_view_all_tickets' => (bool) $user['can_view_all_tickets'],
|
||||
];
|
||||
|
||||
Session::set('user_info', $userInfo);
|
||||
|
||||
return $userInfo;
|
||||
return $userInfo; // 为了方便前端展示用户信息
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user