mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-06 13:05:09 +00:00
refactor: GetFile
This commit is contained in:
@@ -302,7 +302,18 @@ export class NTQQFileApi {
|
||||
async downloadMediaByUuid() {
|
||||
//napCatCore.session.getRichMediaService().downloadFileForFileUuid();
|
||||
}
|
||||
|
||||
async downloadFileForModelId(peer: Peer, modelId: string, timeout = 1000 * 60 * 2) {
|
||||
const [, fileTransNotifyInfo] = await this.core.eventWrapper.callNormalEventV2(
|
||||
'NodeIKernelRichMediaService/downloadFileForModelId',
|
||||
'NodeIKernelMsgListener/onRichMediaDownloadComplete',
|
||||
[peer, [modelId]],
|
||||
() => true,
|
||||
(arg) => arg?.commonFileInfo?.fileModelId === modelId,
|
||||
1,
|
||||
timeout,
|
||||
);
|
||||
return fileTransNotifyInfo.filePath;
|
||||
}
|
||||
async downloadMedia(msgId: string, chatType: ChatType, peerUid: string, elementId: string, thumbPath: string, sourcePath: string, timeout = 1000 * 60 * 2, force: boolean = false) {
|
||||
//logDebug('receive downloadMedia task', msgId, chatType, peerUid, elementId, thumbPath, sourcePath, timeout, force);
|
||||
// 用于下载收到的消息中的图片等
|
||||
|
||||
@@ -1,5 +1,25 @@
|
||||
import { ChatType, RawMessage } from '@/core/entities';
|
||||
|
||||
export interface CommonFileInfo {
|
||||
bizType: null;
|
||||
chatType: number;
|
||||
elemId: string;
|
||||
favId: null;
|
||||
fileModelId: string;
|
||||
fileName: string;
|
||||
fileSize: string;
|
||||
md5: string;
|
||||
md510m: string;
|
||||
msgId: string;
|
||||
msgTime: string;
|
||||
parent: null;
|
||||
peerUid: string;
|
||||
picThumbPath: null;
|
||||
sha: string;
|
||||
sha3: string;
|
||||
subId: string;
|
||||
uuid: string;
|
||||
[property: string]: any;
|
||||
}
|
||||
export interface OnRichMediaDownloadCompleteParams {
|
||||
fileModelId: string,
|
||||
msgElementId: string,
|
||||
@@ -15,7 +35,7 @@ export interface OnRichMediaDownloadCompleteParams {
|
||||
totalSize: string,
|
||||
trasferStatus: number,
|
||||
step: number,
|
||||
commonFileInfo: unknown | null,
|
||||
commonFileInfo?: CommonFileInfo,
|
||||
fileSrvErrCode: string,
|
||||
clientMsg: string,
|
||||
businessId: number,
|
||||
|
||||
@@ -155,7 +155,7 @@ export interface NodeIKernelRichMediaService {
|
||||
}): unknown;
|
||||
|
||||
//arg3为“”
|
||||
downloadFileForModelId(peer: Peer, ModelId: string[], arg3: string): unknown;
|
||||
downloadFileForModelId(peer: Peer, ModelId: string[]): Promise<unknown>;
|
||||
|
||||
//第三个参数 Array<Type>
|
||||
// this.fileId = "";
|
||||
|
||||
Reference in New Issue
Block a user