* 清理指定消息的所有附件 * @param pageId 页面ID * @param messageId 消息ID
(
pageId: string,
messageId: string
)
| 145 | * @param messageId 消息ID |
| 146 | */ |
| 147 | async cleanupMessageAttachments( |
| 148 | pageId: string, |
| 149 | messageId: string |
| 150 | ): Promise<{ success: boolean; error?: string }> { |
| 151 | try { |
| 152 | const targetDir = path.join(this.attachmentsDir, pageId, messageId) |
| 153 | await rm(targetDir, { recursive: true, force: true }) |
| 154 | return { success: true } |
| 155 | } catch (error) { |
| 156 | console.error('清理消息附件失败:', error) |
| 157 | return { |
| 158 | success: false, |
| 159 | error: error instanceof Error ? error.message : '清理消息附件失败' |
| 160 | } |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | /** |
| 165 | * 清理指定页面的所有附件 |
no outgoing calls
no test coverage detected