* 移动附件(从temp到正式目录) * @param fileId 文件ID * @param fileName 文件名 * @param fromPath 源路径(相对路径) * @param pageId 目标页面ID * @param messageId 目标消息ID
(
fileId: string,
fileName: string,
fromPath: string,
pageId: string,
messageId: string
)
| 94 | * @param messageId 目标消息ID |
| 95 | */ |
| 96 | async moveAttachment( |
| 97 | fileId: string, |
| 98 | fileName: string, |
| 99 | fromPath: string, |
| 100 | pageId: string, |
| 101 | messageId: string |
| 102 | ): Promise<{ success: boolean; localPath?: string; error?: string }> { |
| 103 | try { |
| 104 | const relativePath = await moveAttachmentFile({ |
| 105 | fileId, |
| 106 | fileName, |
| 107 | fromPath, |
| 108 | pageId, |
| 109 | messageId |
| 110 | }) |
| 111 | return { success: true, localPath: relativePath } |
| 112 | } catch (error) { |
| 113 | console.error('移动附件失败:', error) |
| 114 | return { |
| 115 | success: false, |
| 116 | error: error instanceof Error ? error.message : '移动附件失败' |
| 117 | } |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | /** |
| 122 | * 清理指定消息的所有附件 |
no test coverage detected