diff --git a/app/common/service/AuthService.php b/app/common/service/AuthService.php index 18bd665..81ec18a 100644 --- a/app/common/service/AuthService.php +++ b/app/common/service/AuthService.php @@ -14,8 +14,8 @@ class AuthService public function login(string $username, string $password) { $user = User::with(['company']) - ->where('username', $username) - ->find(); + ->where('username', $username) + ->find(); @@ -29,6 +29,7 @@ class AuthService $userInfo = [ + 'id' => $user['id'], // 用户ID 'company_name' => $user['company']['company_name'], // 所属公司名称 'username' => $user['username'], 'role' => $user['role'], @@ -37,6 +38,5 @@ class AuthService Session::set('user_info', $user); return $userInfo; - } }