Skip to content

Commit

Permalink
chore: 移除无用代码
Browse files Browse the repository at this point in the history
  • Loading branch information
MliKiowa committed Aug 25, 2024
1 parent adfd123 commit 5486ffc
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 19 deletions.
17 changes: 3 additions & 14 deletions src/common/framework/event-legacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,21 +95,10 @@ export class LegacyNTEventWrapper {

async callNoListenerEvent<EventType extends (...args: any[]) => Promise<any> | any>(
EventName = '',
timeout: number = 3000,
...args: Parameters<EventType>
) {
return new Promise<Awaited<ReturnType<EventType>>>(async (resolve, reject) => {
const EventFunc = this.createEventFunction<EventType>(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<Awaited<ReturnType<EventType>>> {
const EventFunc = this.createEventFunction<EventType>(EventName);
return EventFunc!(...args)
}

async RegisterListen<ListenerType extends (...args: any[]) => void>(
Expand Down
6 changes: 3 additions & 3 deletions src/core/apis/friend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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']>(
'NodeIKernelProfileService/getCoreAndBaseInfo', 5000, 'nodeStore', uids,
'NodeIKernelProfileService/getCoreAndBaseInfo', 'nodeStore', uids,
);
return Array.from(data.values());
}
Expand All @@ -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']>(
'NodeIKernelProfileService/getCoreAndBaseInfo', 5000, 'nodeStore', uids,
'NodeIKernelProfileService/getCoreAndBaseInfo', 'nodeStore', uids,
);
data.forEach((value, key) => {
retMap.set(value.uin!, value.uid!);
Expand All @@ -55,7 +55,7 @@ export class NTQQFriendApi {
return item.buddyUids;
}));
const data = await this.core.eventWrapper.callNoListenerEvent<NodeIKernelProfileService['getCoreAndBaseInfo']>(
'NodeIKernelProfileService/getCoreAndBaseInfo', 5000, 'nodeStore', uids,
'NodeIKernelProfileService/getCoreAndBaseInfo', 'nodeStore', uids,
);
return buddyListV2.map(category => ({
categoryId: category.categoryId,
Expand Down
1 change: 0 additions & 1 deletion src/core/apis/system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export class NTQQSystemApi {
arkJson: string
}>>(
'NodeIKernelCollectionService/collectionArkShare',
5000,
'1717662698058',
);
return ret;
Expand Down
2 changes: 1 addition & 1 deletion src/core/apis/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ export class NTQQUserApi {

async getUserDetailInfoByUinV2(Uin: string) {
return await this.core.eventWrapper.callNoListenerEvent<(Uin: string) => Promise<UserDetailInfoByUinV2>>
('NodeIKernelProfileService/getUserDetailInfoByUin', 5000, Uin);
('NodeIKernelProfileService/getUserDetailInfoByUin', Uin);
}

async forceFetchClientKey() {
Expand Down

0 comments on commit 5486ffc

Please sign in to comment.