1.新增退出登录的接口

This commit is contained in:
2026-05-29 14:25:59 +08:00
parent 4324c19d30
commit 4bd332a6ff
5 changed files with 138 additions and 19 deletions

View File

@@ -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) {