fix: 多处修复

1.修复部分Uin转换失败导致的相关API错误
2.继续改进get_group_member_info效率
3.增加fetchUserDetailInfo容错(暂时性/待观察)
This commit is contained in:
Alen
2024-08-19 15:39:34 +08:00
parent 698624b4dc
commit 836eb7b708
3 changed files with 21 additions and 18 deletions

View File

@@ -261,7 +261,7 @@ export class NTQQGroupApi {
(
'NodeIKernelGroupListener/onMemberInfoChange',
1,
forced ? 5000 : 500,
forced ? 5000 : 250,
(params) => {
return params === GroupCode;
},
@@ -269,7 +269,7 @@ export class NTQQGroupApi {
const EventFunc = this.core.eventWrapper.createEventFunction<EventType>('NodeIKernelGroupService/getMemberInfo');
const retData = await EventFunc!(GroupCode, [uid], forced);
if (retData.result !== 0) {
throw new Error(`获取群成员信息失败: ${retData.errMsg}`);
throw new Error(`${retData.errMsg}`);
}
const result = await Listener as unknown;
let member: GroupMember | undefined;

View File

@@ -120,7 +120,7 @@ export class NTQQUserApi {
...profile.simpleInfo.vasInfo,
...profile.commonExt,
...profile.simpleInfo.baseInfo,
qqLevel: profile.commonExt.qqLevel,
qqLevel: profile.commonExt?.qqLevel,
age: profile.simpleInfo.baseInfo.age,
pendantId: '',
};
@@ -130,7 +130,7 @@ export class NTQQUserApi {
async getUserDetailInfo(uid: string) {
const ret = await this.fetchUserDetailInfo(uid, UserDetailSource.KDB);
if (ret.uin === '0') {
console.log('[NapCat] [Mark] getUserDetailInfo Mode1 Failed.')
this.context.logger.logDebug('[NapCat] [Mark] getUserDetailInfo Mode1 Failed.')
return await this.fetchUserDetailInfo(uid, UserDetailSource.KSERVER);
}
return ret;
@@ -207,9 +207,9 @@ export class NTQQUserApi {
//后期改成流水线处理
async getUinByUidV2(Uid: string) {
let uin = (await this.context.session.getProfileService().getUinByUid('FriendsServiceImpl', [Uid])).get(Uid);
let uin = (await this.context.session.getGroupService().getUinByUids([Uid])).uins.get(Uid);
if (uin) return uin;
uin = (await this.context.session.getGroupService().getUinByUids([Uid])).uins.get(Uid);
uin = (await this.context.session.getProfileService().getUinByUid('FriendsServiceImpl', [Uid])).get(Uid);
if (uin) return uin;
uin = (await this.context.session.getUixConvertService().getUin([Uid])).uinInfo.get(Uid);
if (uin) return uin;