mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-01-16 05:10:34 +00:00
fix: search file
This commit is contained in:
parent
620d61c8dc
commit
18892379de
@ -17,6 +17,7 @@ import { ISizeCalculationResult } from 'image-size/dist/types/interface';
|
|||||||
import { sessionConfig } from '@/core/sessionConfig';
|
import { sessionConfig } from '@/core/sessionConfig';
|
||||||
import { rkeyManager } from '../utils/rkey';
|
import { rkeyManager } from '../utils/rkey';
|
||||||
import { NTEventDispatch } from '@/common/utils/EventTask';
|
import { NTEventDispatch } from '@/common/utils/EventTask';
|
||||||
|
import { NodeIKernelSearchService } from '../services/NodeIKernelSearchService';
|
||||||
|
|
||||||
export class NTQQFileApi {
|
export class NTQQFileApi {
|
||||||
static async getFileType(filePath: string) {
|
static async getFileType(filePath: string) {
|
||||||
@ -145,6 +146,58 @@ export class NTQQFileApi {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
static async searchfile(keys: string[]) {
|
||||||
|
|
||||||
|
type EventType = NodeIKernelSearchService['searchFileWithKeywords'];
|
||||||
|
interface OnListener {
|
||||||
|
searchId: string,
|
||||||
|
hasMore: boolean,
|
||||||
|
resultItems: {
|
||||||
|
chatType: ChatType,
|
||||||
|
buddyChatInfo: any[],
|
||||||
|
discussChatInfo: any[],
|
||||||
|
groupChatInfo:
|
||||||
|
{
|
||||||
|
groupCode: string,
|
||||||
|
isConf: boolean,
|
||||||
|
hasModifyConfGroupFace: boolean,
|
||||||
|
hasModifyConfGroupName: boolean,
|
||||||
|
groupName: string,
|
||||||
|
remark: string
|
||||||
|
}[]
|
||||||
|
,
|
||||||
|
dataLineChatInfo: any[],
|
||||||
|
tmpChatInfo: any[],
|
||||||
|
msgId: string,
|
||||||
|
msgSeq: string,
|
||||||
|
msgTime: string,
|
||||||
|
senderUid: string,
|
||||||
|
senderNick: string,
|
||||||
|
senderRemark: string,
|
||||||
|
senderCard: string,
|
||||||
|
elemId: string,
|
||||||
|
elemType: number,
|
||||||
|
fileSize: string,
|
||||||
|
filePath: string,
|
||||||
|
fileName: string,
|
||||||
|
hits:
|
||||||
|
{
|
||||||
|
start: number,
|
||||||
|
end: number
|
||||||
|
}[]
|
||||||
|
}[]
|
||||||
|
};
|
||||||
|
const [id, data] = await NTEventDispatch.CallNormalEvent<EventType, (params: OnListener) => void>(
|
||||||
|
'NodeIKernelSearchService/searchFileWithKeywords',
|
||||||
|
'NodeIKernelSearchListener/onSearchFileKeywordsResult',
|
||||||
|
1,
|
||||||
|
10000,
|
||||||
|
(arg): boolean => { return id == data.searchId },
|
||||||
|
keys,
|
||||||
|
12
|
||||||
|
);
|
||||||
|
return data.resultItems[0];
|
||||||
|
}
|
||||||
static async getImageUrl(element: { originImageUrl: any; md5HexStr?: any; fileUuid: any; }) {
|
static async getImageUrl(element: { originImageUrl: any; md5HexStr?: any; fileUuid: any; }) {
|
||||||
if (!element) {
|
if (!element) {
|
||||||
return '';
|
return '';
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
export interface NodeIKernelSearchService{
|
export interface NodeIKernelSearchService {
|
||||||
addKernelSearchListenerr(...args: any[]): unknown;// needs 1 arguments
|
addKernelSearchListenerr(...args: any[]): unknown;// needs 1 arguments
|
||||||
|
|
||||||
removeKernelSearchListenerr(...args: any[]): unknown;// needs 1 arguments
|
removeKernelSearchListenerr(...args: any[]): unknown;// needs 1 arguments
|
||||||
@ -49,9 +49,9 @@ export interface NodeIKernelSearchService{
|
|||||||
|
|
||||||
searchMoreMsgWithKeywordsr(...args: any[]): unknown;// needs 1 arguments
|
searchMoreMsgWithKeywordsr(...args: any[]): unknown;// needs 1 arguments
|
||||||
|
|
||||||
cancelSearchMsgWithKeywordsr(...args: any[]): unknown;// needs 3 arguments
|
cancelSearchMsgWithKeywords(...args: any[]): unknown;// needs 3 arguments
|
||||||
|
|
||||||
searchFileWithKeywordsr(...args: any[]): unknown;// needs 2 arguments
|
searchFileWithKeywords(keywords: string[], source: number): Promise<unknown>;// needs 2 arguments
|
||||||
|
|
||||||
searchMoreFileWithKeywordsr(...args: any[]): unknown;// needs 1 arguments
|
searchMoreFileWithKeywordsr(...args: any[]): unknown;// needs 1 arguments
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user