feat: 审核通过移动文件到approved,拒绝删除pending文件

- StorageService 新增 delete()
- approve: 文件 pending → approved
- reject: 删除 pending 文件
This commit is contained in:
mediabot-pt
2026-06-29 23:21:44 +08:00
parent 7d7de75bbd
commit b806a01f13
5 changed files with 33 additions and 0 deletions

View File

@@ -55,4 +55,10 @@ public class CachedStorageService implements StorageService {
if (isQiniuMode()) return local.exists(path) || qiniu.exists(path);
return local.exists(path);
}
@Override
public void delete(String path) {
local.delete(path);
if (isQiniuMode()) qiniu.delete(path);
}
}

View File

@@ -63,4 +63,13 @@ public class LocalStorageService implements StorageService {
public boolean exists(String path) {
return Files.exists(baseDir.resolve(path));
}
@Override
public void delete(String path) {
try {
Files.deleteIfExists(baseDir.resolve(path));
} catch (IOException e) {
log.warn("删除文件失败 {}: {}", path, e.getMessage());
}
}
}

View File

@@ -93,6 +93,17 @@ public class QiniuStorageService implements StorageService {
}
}
@Override
public void delete(String path) {
ensureInit();
try {
bucketManager.delete(bucket, path);
log.debug("Qiniu 删除: {}", path);
} catch (QiniuException e) {
log.warn("Qiniu 删除失败 {}: {}", path, e.response != null ? e.response.error : e.getMessage());
}
}
private static String env(String key) { return System.getenv(key); }
private static String env(String key, String def) {
String v = System.getenv(key);

View File

@@ -15,4 +15,7 @@ public interface StorageService {
/** 检查是否存在 */
boolean exists(String path);
/** 删除文件 */
void delete(String path);
}