diff --git a/src/core/src/apis/friend.ts b/src/core/src/apis/friend.ts index 01b9cb6a..047000be 100644 --- a/src/core/src/apis/friend.ts +++ b/src/core/src/apis/friend.ts @@ -1,8 +1,14 @@ import { FriendRequest, User } from '@/core/entities'; -import { napCatCore, OnBuddyChangeParams } from '@/core'; +import { BuddyListReqType, napCatCore, OnBuddyChangeParams } from '@/core'; import { NTEventDispatch } from '@/common/utils/EventTask'; export class NTQQFriendApi { + static async getBuddyV2(refresh = false) { + if (!refresh) { + return await napCatCore.session.getBuddyService().getBuddyListFromCache('0'); + } + return (await (napCatCore.session.getBuddyService().getBuddyListV2('0', BuddyListReqType.KNOMAL))).data; + } static async isBuddy(uid: string) { return napCatCore.session.getBuddyService().isBuddy(uid); } diff --git a/src/core/src/apis/user.ts b/src/core/src/apis/user.ts index fda691a8..4c137930 100644 --- a/src/core/src/apis/user.ts +++ b/src/core/src/apis/user.ts @@ -65,6 +65,43 @@ export class NTQQUserApi { // KQZONE, // KOTHER // } + static async fetchUserDetailInfos(uids: string[]) { + type EventService = NodeIKernelProfileService['fetchUserDetailInfo']; + type EventListener = NodeIKernelProfileListener['onUserDetailInfoChanged']; + let retData: User[] = []; + let [_retData, _retListener] = await NTEventDispatch.CallNormalEvent + + ( + 'NodeIKernelProfileService/fetchUserDetailInfo', + 'NodeIKernelProfileListener/onUserDetailInfoChanged', + uids.length, + 5000, + (profile) => { + if (uids.includes(profile.uid)) { + let RetUser: User = { + ...profile.simpleInfo.coreInfo, + ...profile.simpleInfo.status, + ...profile.simpleInfo.vasInfo, + ...profile.commonExt, + ...profile.simpleInfo.baseInfo, + qqLevel: profile.commonExt.qqLevel, + pendantId: "" + }; + retData.push(RetUser); + return true; + } + return false; + }, + "BuddyProfileStore", + uids, + UserDetailSource.KSERVER, + [ + ProfileBizType.KALL + ] + ); + + return retData; + } static async fetchUserDetailInfo(uid: string) { type EventService = NodeIKernelProfileService['fetchUserDetailInfo']; type EventListener = NodeIKernelProfileListener['onUserDetailInfoChanged']; diff --git a/src/core/src/services/NodeIKernelBuddyService.ts b/src/core/src/services/NodeIKernelBuddyService.ts index be868d75..1d28a300 100644 --- a/src/core/src/services/NodeIKernelBuddyService.ts +++ b/src/core/src/services/NodeIKernelBuddyService.ts @@ -7,7 +7,16 @@ export enum BuddyListReqType { } export interface NodeIKernelBuddyService { // 26702 以上 - getBuddyListV2(callFrom: string, reqType: BuddyListReqType): Promise; + getBuddyListV2(callFrom: string, reqType: BuddyListReqType): Promise + }> + }>; //26702 以上 getBuddyListFromCache(callFrom: string): Promise