提取 redis sid key 的字面量为函数

This commit is contained in:
liangtongchuan
2021-03-04 11:42:59 +08:00
parent fd5df13be1
commit 578b890630
7 changed files with 22 additions and 18 deletions
+5 -1
View File
@@ -358,8 +358,12 @@ export async function delRedis(key: string) {
await client.delAsync(key);
}
export function redisSidKey(roleId: string) {
return `login_roleId_${roleId}`;
}
export async function isRoleOnline(roleId: string) {
let key = `login_roleId_${roleId}`;
let key = redisSidKey(roleId);
let result = await getRedis(key);
return !!result;
}