1.新增退出登录的接口
This commit is contained in:
@@ -122,6 +122,21 @@ final class MobileAuthDeviceService
|
||||
*
|
||||
* @return string|null 失败时返回多语言 message key,成功返回 null
|
||||
*/
|
||||
/**
|
||||
* 用户主动退出:清除 Redis 中的活跃设备绑定。
|
||||
*/
|
||||
public static function onUserLogout(int $userId): void
|
||||
{
|
||||
if ($userId <= 0) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Redis::del(self::PREFIX_USER_DEVICE . $userId);
|
||||
} catch (Throwable) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
public static function validateUserDeviceSession(string $authToken, int $userId): ?string
|
||||
{
|
||||
if ($userId <= 0) {
|
||||
|
||||
Reference in New Issue
Block a user