From 5486ffcdcc1262eeb47b4d009895d5852d269e6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Mon, 26 Aug 2024 00:38:19 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E7=A7=BB=E9=99=A4=E6=97=A0=E7=94=A8?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/framework/event-legacy.ts | 17 +++-------------- src/core/apis/friend.ts | 6 +++--- src/core/apis/system.ts | 1 - src/core/apis/user.ts | 2 +- 4 files changed, 7 insertions(+), 19 deletions(-) diff --git a/src/common/framework/event-legacy.ts b/src/common/framework/event-legacy.ts index 6aa6a13e..4a24ceb9 100644 --- a/src/common/framework/event-legacy.ts +++ b/src/common/framework/event-legacy.ts @@ -95,21 +95,10 @@ export class LegacyNTEventWrapper { async callNoListenerEvent Promise | any>( EventName = '', - timeout: number = 3000, ...args: Parameters - ) { - return new Promise>>(async (resolve, reject) => { - const EventFunc = this.createEventFunction(EventName); - let complete = false; - setTimeout(() => { - if (!complete) { - reject(new Error('NTEvent EventName:' + EventName + ' timeout')); - } - }, timeout); - const retData = await EventFunc!(...args); - complete = true; - resolve(retData); - }); + ): Promise>> { + const EventFunc = this.createEventFunction(EventName); + return EventFunc!(...args) } async RegisterListen void>( diff --git a/src/core/apis/friend.ts b/src/core/apis/friend.ts index 67be161c..7bd6047e 100644 --- a/src/core/apis/friend.ts +++ b/src/core/apis/friend.ts @@ -21,7 +21,7 @@ export class NTQQFriendApi { const buddyListV2 = refresh ? await buddyService.getBuddyListV2('0', BuddyListReqType.KNOMAL) : await buddyService.getBuddyListV2('0', BuddyListReqType.KNOMAL); uids.push(...buddyListV2.data.flatMap(item => item.buddyUids)); const data = await this.core.eventWrapper.callNoListenerEvent( - 'NodeIKernelProfileService/getCoreAndBaseInfo', 5000, 'nodeStore', uids, + 'NodeIKernelProfileService/getCoreAndBaseInfo', 'nodeStore', uids, ); return Array.from(data.values()); } @@ -33,7 +33,7 @@ export class NTQQFriendApi { const buddyListV2 = refresh ? await buddyService.getBuddyListV2('0', BuddyListReqType.KNOMAL) : await buddyService.getBuddyListV2('0', BuddyListReqType.KNOMAL); uids.push(...buddyListV2.data.flatMap(item => item.buddyUids)); const data = await this.core.eventWrapper.callNoListenerEvent( - 'NodeIKernelProfileService/getCoreAndBaseInfo', 5000, 'nodeStore', uids, + 'NodeIKernelProfileService/getCoreAndBaseInfo', 'nodeStore', uids, ); data.forEach((value, key) => { retMap.set(value.uin!, value.uid!); @@ -55,7 +55,7 @@ export class NTQQFriendApi { return item.buddyUids; })); const data = await this.core.eventWrapper.callNoListenerEvent( - 'NodeIKernelProfileService/getCoreAndBaseInfo', 5000, 'nodeStore', uids, + 'NodeIKernelProfileService/getCoreAndBaseInfo', 'nodeStore', uids, ); return buddyListV2.map(category => ({ categoryId: category.categoryId, diff --git a/src/core/apis/system.ts b/src/core/apis/system.ts index 4b23a7dc..941c3783 100644 --- a/src/core/apis/system.ts +++ b/src/core/apis/system.ts @@ -32,7 +32,6 @@ export class NTQQSystemApi { arkJson: string }>>( 'NodeIKernelCollectionService/collectionArkShare', - 5000, '1717662698058', ); return ret; diff --git a/src/core/apis/user.ts b/src/core/apis/user.ts index d0cb8955..d07ec121 100644 --- a/src/core/apis/user.ts +++ b/src/core/apis/user.ts @@ -238,7 +238,7 @@ export class NTQQUserApi { async getUserDetailInfoByUinV2(Uin: string) { return await this.core.eventWrapper.callNoListenerEvent<(Uin: string) => Promise> - ('NodeIKernelProfileService/getUserDetailInfoByUin', 5000, Uin); + ('NodeIKernelProfileService/getUserDetailInfoByUin', Uin); } async forceFetchClientKey() {