mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-13 08:20:27 +00:00
refctor: getBuddyV2 支持分类
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ export interface OB11User {
|
||||
age?: number;
|
||||
qid?: string;
|
||||
login_days?: number;
|
||||
categroyName?:string;
|
||||
categoryId?:number;
|
||||
}
|
||||
|
||||
export enum OB11UserSex {
|
||||
|
||||
Reference in New Issue
Block a user