* 删除附件 * @param localPath 相对路径
(localPath: string)
| 89 | * @param localPath 相对路径 |
| 90 | */ |
| 91 | async deleteAttachment(localPath: string): Promise<{ success: boolean; error?: string }> { |
| 92 | try { |
| 93 | const fullPath = path.join(this.attachmentsDir, localPath) |
| 94 | await unlink(fullPath) |
| 95 | return { success: true } |
| 96 | } catch (error) { |
| 97 | console.error('删除附件失败:', error) |
| 98 | return { |
| 99 | success: false, |
| 100 | error: error instanceof Error ? error.message : '删除附件失败' |
| 101 | } |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | /** |
| 106 | * 移动附件(从temp到正式目录) |
no outgoing calls
no test coverage detected