完善生产查询与登录权限配置

This commit is contained in:
2026-09-03 19:56:19 +08:00
parent 793f140a45
commit 02c8fb7021
438 changed files with 1595 additions and 573 deletions
+13 -7
View File
@@ -59,6 +59,8 @@ class AuthService extends BaseService
// 更新登录信息
$this->updateLoginInfo($member);
$channel = strtolower((string)request()->header('channel', 'pc'));
$clientType = $channel === 'app' ? 'app' : 'web';
$userInfo = [
'id' => $member->id,
'username' => $member->username,
@@ -66,13 +68,14 @@ class AuthService extends BaseService
'avatar' => $member->avatar,
'phone' => $member->phone,
'email' => $member->email,
'client' => 'web',
'access_exp' => 7200,
'client' => $clientType,
'access_exp' => 3600,
'refresh_exp' => 604800,
];
// 使用新的 JwtToken 生成 token
$jwt = new JwtToken();
$tokenObj = $jwt->generate((string)$member->id, 'api', $userInfo);
$tokenObj = $jwt->generate((string)$member->id, $clientType, $userInfo);
$userInfo['access_exp'] = $tokenObj->expiresIn;
$token = [
'access_token' => $tokenObj->accessToken,
'refresh_token' => $tokenObj->refreshToken,
@@ -110,6 +113,8 @@ class AuthService extends BaseService
$this->updateLoginInfo($member);
// 生成token
$channel = strtolower((string)request()->header('channel', 'pc'));
$clientType = $channel === 'app' ? 'app' : 'web';
$userInfo = [
'id' => $member->id,
'username' => $member->username,
@@ -117,13 +122,14 @@ class AuthService extends BaseService
'avatar' => $member->avatar,
'phone' => $member->phone,
'email' => $member->email,
'client' => 'web',
'access_exp' => 7200,
'client' => $clientType,
'access_exp' => 3600,
'refresh_exp' => 604800,
];
// 使用新的 JwtToken 生成 token
$jwt = new JwtToken();
$tokenObj = $jwt->generate((string)$member->id, 'api', $userInfo);
$tokenObj = $jwt->generate((string)$member->id, $clientType, $userInfo);
$userInfo['access_exp'] = $tokenObj->expiresIn;
$token = [
'access_token' => $tokenObj->accessToken,
'refresh_token' => $tokenObj->refreshToken,
@@ -702,4 +708,4 @@ HTML;
throw new \Exception('登录已过期', 401);
}
}
}
}