mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-03-01 08:10:25 +00:00
增加/fetch_emoji_likes_all (#1548)
* Update FetchEmojiLike.ts * 减少getMsgEmojiLikesList参数,一次性全部拉取 * Update FetchEmojiLike.ts * Refactor API message schema and update descriptions * Update and rename FetchEmojiLike.ts to FetchEmojiLikesAll.ts * Create FetchEmojiLike.ts * Update router.ts * Update index.ts * Update index.ts * Update FetchEmojiLikesAll.ts * Update FetchEmojiLikesAll.ts * Refactor emoji likes API and update related logic Replaces FetchEmojiLikesAll with GetEmojiLikes, updating the API to use a new payload and return schema. Adjusts action registration, router action names, and frontend API mapping accordingly. Adds isShortId utility to MessageUnique for improved message ID handling. --------- Co-authored-by: 手瓜一十雪 <nanaeonn@outlook.com>
This commit is contained in:
@@ -58,12 +58,12 @@ export class LimitedHashTable<K, V> {
|
||||
}
|
||||
|
||||
// 获取最近刚写入的几个值
|
||||
getHeads (size: number): { key: K; value: V }[] | undefined {
|
||||
getHeads (size: number): { key: K; value: V; }[] | undefined {
|
||||
const keyList = this.getKeyList();
|
||||
if (keyList.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
const result: { key: K; value: V }[] = [];
|
||||
const result: { key: K; value: V; }[] = [];
|
||||
const listSize = Math.min(size, keyList.length);
|
||||
for (let i = 0; i < listSize; i++) {
|
||||
const key = keyList[listSize - i];
|
||||
@@ -108,7 +108,7 @@ class MessageUniqueWrapper {
|
||||
return shortId;
|
||||
}
|
||||
|
||||
getMsgIdAndPeerByShortId (shortId: number): { MsgId: string; Peer: Peer } | undefined {
|
||||
getMsgIdAndPeerByShortId (shortId: number): { MsgId: string; Peer: Peer; } | undefined {
|
||||
const data = this.msgDataMap.getKey(shortId);
|
||||
if (data) {
|
||||
const [msgId, chatTypeStr, peerUid] = data.split('|');
|
||||
@@ -136,6 +136,12 @@ class MessageUniqueWrapper {
|
||||
this.msgIdMap.resize(maxSize);
|
||||
this.msgDataMap.resize(maxSize);
|
||||
}
|
||||
|
||||
isShortId (message_id: string): boolean {
|
||||
const num = Number(message_id);
|
||||
// 判断是否是整数并且在 INT32 的范围内
|
||||
return Number.isInteger(num) && num >= -2147483648 && num <= 2147483647;
|
||||
}
|
||||
}
|
||||
|
||||
export const MessageUnique: MessageUniqueWrapper = new MessageUniqueWrapper();
|
||||
|
||||
Reference in New Issue
Block a user