mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
chore: NTApi Finish
This commit is contained in:
parent
ffe480ad44
commit
7842cd0bc0
@ -26,8 +26,8 @@ export class NTQQGroupApi {
|
||||
);
|
||||
return groupList;
|
||||
}
|
||||
async getGroupMemberLatestSendTimeCache(GroupCode: string) {
|
||||
return this.getGroupMemberLatestSendTime(GroupCode);
|
||||
async getGroupMemberLatestSendTimeCache(GroupCode: string, uids: string[]) {
|
||||
return this.getGroupMemberLatestSendTime(GroupCode, uids);
|
||||
}
|
||||
/**
|
||||
* 通过QQ自带数据库获取群成员最后发言时间(仅返回有效数据 且消耗延迟大 需要进行缓存)
|
||||
@ -39,7 +39,7 @@ export class NTQQGroupApi {
|
||||
* console.log(uin, sendTime);
|
||||
* }
|
||||
*/
|
||||
async getGroupMemberLatestSendTime(GroupCode: string) {
|
||||
async getGroupMemberLatestSendTime(GroupCode: string, uids: string[]) {
|
||||
const getdata = async (uid: string) => {
|
||||
const NTRet = await this.getLatestMsgByUids(GroupCode, [uid]);
|
||||
if (NTRet.result != 0 && NTRet.msgList.length < 1) {
|
||||
@ -47,17 +47,13 @@ export class NTQQGroupApi {
|
||||
}
|
||||
return { sendUin: NTRet.msgList[0].senderUin, sendTime: NTRet.msgList[0].msgTime };
|
||||
};
|
||||
const currentGroupMembers = groupMembers.get(GroupCode);
|
||||
const PromiseData: Promise<({
|
||||
sendUin: string;
|
||||
sendTime: string;
|
||||
} | undefined)>[] = [];
|
||||
const ret: Map<string, string> = new Map();
|
||||
if (!currentGroupMembers) {
|
||||
return ret;
|
||||
}
|
||||
for (const member of currentGroupMembers.values()) {
|
||||
PromiseData.push(getdata(member.uid).catch(() => undefined));
|
||||
for (const uid of uids) {
|
||||
PromiseData.push(getdata(uid).catch(() => undefined));
|
||||
}
|
||||
const allRet = await runAllWithTimeout(PromiseData, 2500);
|
||||
for (const PromiseDo of allRet) {
|
||||
|
@ -253,24 +253,6 @@ export class NTQQUserApi {
|
||||
async getUidByUinV1(Uin: string) {
|
||||
// 通用转换开始尝试
|
||||
let uid = (await this.context.session.getUixConvertService().getUid([Uin])).uidInfo.get(Uin);
|
||||
// Uid 好友转
|
||||
if (!uid) {
|
||||
Array.from(friends.values()).forEach((t) => {
|
||||
if (t.uin == Uin) {
|
||||
uid = t.uid;
|
||||
}
|
||||
});
|
||||
}
|
||||
//Uid 群友列表转
|
||||
if (!uid) {
|
||||
for (let groupMembersList of groupMembers.values()) {
|
||||
for (let GroupMember of groupMembersList.values()) {
|
||||
if (GroupMember.uin == Uin) {
|
||||
uid = GroupMember.uid;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!uid) {
|
||||
let unveifyUid = (await this.getUserDetailInfoByUin(Uin)).info.uid;//从QQ Native 特殊转换 方法三
|
||||
if (unveifyUid.indexOf("*") == -1) {
|
||||
@ -287,18 +269,9 @@ export class NTQQUserApi {
|
||||
[Uid]
|
||||
);
|
||||
let uin = ret.uinInfo.get(Uid);
|
||||
if (!uin) {
|
||||
//从Buddy缓存获取Uin
|
||||
Array.from(friends.values()).forEach((t) => {
|
||||
if (t.uid == Uid) {
|
||||
uin = t.uin;
|
||||
}
|
||||
})
|
||||
}
|
||||
if (!uin) {
|
||||
uin = (await this.getUserDetailInfo(Uid)).uin; //从QQ Native 转换
|
||||
}
|
||||
|
||||
// if (!uin) {
|
||||
// uin = (await NTQQFriendApi.getFriends(false)).find((t) => { t.uid == Uid })?.uin; //从QQ Native 缓存转换
|
||||
// }
|
||||
|
Loading…
x
Reference in New Issue
Block a user