Compare commits

...

2 Commits

Author SHA1 Message Date
手瓜一十雪
8fb8c888f5 refactor: 移除未使用的uidCache和uinCache逻辑 2024-12-04 19:48:59 +08:00
Mlikiowa
4a2884509e release: v4.2.20 2024-12-04 11:46:12 +00:00
4 changed files with 3 additions and 15 deletions

View File

@@ -4,7 +4,7 @@
"name": "NapCatQQ",
"slug": "NapCat.Framework",
"description": "高性能的 OneBot 11 协议实现",
"version": "4.2.19",
"version": "4.2.20",
"icon": "./logo.png",
"authors": [
{

View File

@@ -2,7 +2,7 @@
"name": "napcat",
"private": true,
"type": "module",
"version": "4.2.19",
"version": "4.2.20",
"scripts": {
"build:universal": "npm run build:webui && vite build --mode universal || exit 1",
"build:framework": "npm run build:webui && vite build --mode framework || exit 1",

View File

@@ -1 +1 @@
export const napCatVersion = '4.2.19';
export const napCatVersion = '4.2.20';

View File

@@ -8,14 +8,10 @@ import { LRUCache } from '@/common/lru-cache';
export class NTQQUserApi {
context: InstanceContext;
core: NapCatCore;
private uidCache: LRUCache<string, string>;
private uinCache: LRUCache<string, string>;
constructor(context: InstanceContext, core: NapCatCore) {
this.context = context;
this.core = core;
this.uidCache = new LRUCache(1000);
this.uinCache = new LRUCache(1000);
}
async getCoreAndBaseInfo(uids: string[]) {
@@ -174,9 +170,6 @@ export class NTQQUserApi {
}
async getUidByUinV2(Uin: string) {
if (this.uidCache.get(Uin)) {
return this.uidCache.get(Uin);
}
const services = [
() => this.context.session.getUixConvertService().getUid([Uin]).then((data) => data.uidInfo.get(Uin)).catch(() => undefined),
() => promisify<string, string[], Map<string, string>>
@@ -188,7 +181,6 @@ export class NTQQUserApi {
for (const service of services) {
uid = await service();
if (uid && uid.indexOf('*') == -1 && uid !== '') {
this.uidCache.put(Uin, uid);
break;
}
}
@@ -196,9 +188,6 @@ export class NTQQUserApi {
}
async getUinByUidV2(Uid: string) {
if (this.uinCache.get(Uid)) {
return this.uinCache.get(Uid);
}
const services = [
() => this.context.session.getUixConvertService().getUin([Uid]).then((data) => data.uinInfo.get(Uid)).catch(() => undefined),
() => this.context.session.getGroupService().getUinByUids([Uid]).then((data) => data.uins.get(Uid)).catch(() => undefined),
@@ -211,7 +200,6 @@ export class NTQQUserApi {
for (const service of services) {
uin = await service();
if (uin && uin !== '0' && uin !== '') {
this.uinCache.put(Uid, uin);
break;
}
}