Skip to content

Commit

Permalink
图片审核
Browse files Browse the repository at this point in the history
  • Loading branch information
adlered committed Nov 5, 2024
1 parent 2ef75cf commit 5f9be68
Showing 1 changed file with 23 additions and 17 deletions.
40 changes: 23 additions & 17 deletions src/main/java/org/b3log/symphony/processor/AdminProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -470,27 +470,33 @@ public void markPic(final RequestContext context) {

// 抹除MD5
status = new JSONObject();
status.put("md5", "deleted");
if ("temp".equals(type)) {
status.put("md5", "temp by " + uname);
} else if ("illegal".equals(type)) {
status.put("md5", "delete by " + uname);
}
transaction = uploadRepository.beginTransaction();
uploadRepository.update(oId, status);
transaction.commit();

// 删除图片
if (QN_ENABLED) {
Auth auth = Auth.create(Symphonys.UPLOAD_QINIU_AK, Symphonys.UPLOAD_QINIU_SK);
Configuration cfg = new Configuration(Region.autoRegion());
BucketManager bucketManager = new BucketManager(auth, cfg);
String filename = path.replaceAll(Symphonys.UPLOAD_QINIU_DOMAIN + "/", "");
LOGGER.log(Level.INFO, "Delete cdn file: " + filename);
bucketManager.delete(Symphonys.UPLOAD_QINIU_BUCKET, filename);
String[] urls = new String[] { path };
CdnManager c = new CdnManager(auth);
CdnResult.RefreshResult result = c.refreshUrls(urls);
LOGGER.log(Level.INFO, "CDN Refresh result: " + result.code);
} else {
context.renderJSON(StatusCodes.ERR);
context.renderMsg("不支持操作本地图床!");
return;
if ("illegal".equals(type)) {
// 删除图片
if (QN_ENABLED) {
Auth auth = Auth.create(Symphonys.UPLOAD_QINIU_AK, Symphonys.UPLOAD_QINIU_SK);
Configuration cfg = new Configuration(Region.autoRegion());
BucketManager bucketManager = new BucketManager(auth, cfg);
String filename = path.replaceAll(Symphonys.UPLOAD_QINIU_DOMAIN + "/", "");
LOGGER.log(Level.INFO, "Delete cdn file: " + filename);
bucketManager.delete(Symphonys.UPLOAD_QINIU_BUCKET, filename);
String[] urls = new String[]{path};
CdnManager c = new CdnManager(auth);
CdnResult.RefreshResult result = c.refreshUrls(urls);
LOGGER.log(Level.INFO, "CDN Refresh result: " + result.code);
} else {
context.renderJSON(StatusCodes.ERR);
context.renderMsg("不支持操作本地图床!");
return;
}
}

// 奖惩
Expand Down

0 comments on commit 5f9be68

Please sign in to comment.