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