refctor: getBuddyV2 支持分类

This commit is contained in:
手瓜一十雪
2024-08-04 16:27:25 +08:00
parent 58f22b24e4
commit 690a2f7d34
5 changed files with 67 additions and 12 deletions

View File

@@ -23,7 +23,7 @@ export default class GetFriendList extends BaseAction<Payload, OB11User[]> {
protected async _handle(payload: Payload) {
if (requireMinNTQQBuild('26702')) {
//全新逻辑
return OB11Constructor.friendsV2(await NTQQFriendApi.getBuddyV2(payload?.no_cache === true || payload?.no_cache === 'true'));
return OB11Constructor.friendsV2(await NTQQFriendApi.getBuddyV2Ex(payload?.no_cache === true || payload?.no_cache === 'true'));
}
if (friends.size === 0 || payload?.no_cache === true || payload?.no_cache === 'true') {
const _friends = await NTQQFriendApi.getFriends(true);

View File

@@ -14,6 +14,7 @@ import {
ChatType,
FaceIndex,
Friend,
FriendV2,
GrayTipElementSubType,
Group,
GroupMember,
@@ -553,11 +554,21 @@ export class OB11Constructor {
nickname: selfInfo.nick,
};
}
static friendsV2(friends: SimpleInfo[]): OB11User[] {
static friendsV2(friends: FriendV2[]): OB11User[] {
const data: OB11User[] = [];
friends.forEach(friend => {
const sexValue = this.sex(friend.baseInfo.sex!);
data.push({ ...friend.baseInfo, ...friend.coreInfo, user_id: parseInt(friend.coreInfo.uin), nickname: friend.coreInfo.nick, remark: friend.coreInfo.nick, sex: sexValue, level: 0 });
data.push({
...friend.baseInfo,
...friend.coreInfo,
user_id: parseInt(friend.coreInfo.uin),
nickname: friend.coreInfo.nick,
remark: friend.coreInfo.nick,
sex: sexValue,
level: 0,
categroyName: friend.categroyName,
categoryId: friend.categoryId
});
});
return data;
}

View File

@@ -7,6 +7,8 @@ export interface OB11User {
age?: number;
qid?: string;
login_days?: number;
categroyName?:string;
categoryId?:number;
}
export enum OB11UserSex {