|
@@ -68,4 +68,25 @@ public class UploadServiceImpl implements UploadService {
|
|
|
return path;
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除服务端文件
|
|
|
+ *
|
|
|
+ * @param path
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Boolean deleteRemoteFile(String path) {
|
|
|
+ if (path.startsWith("/")) {
|
|
|
+ path = path.substring(1);
|
|
|
+ }
|
|
|
+ String fileName = path.substring(path.indexOf("/") + 1);
|
|
|
+ String groupName = path.substring(0, path.indexOf("/"));
|
|
|
+ try {
|
|
|
+ FastDFSClient.deleteFile(groupName, fileName);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("", e);
|
|
|
+ throw new CommonException(ServiceErrorCode.FILE_DELETE_ERROR, "delete file failed");
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|