Skip to content

Commit

Permalink
图片审核
Browse files Browse the repository at this point in the history
  • Loading branch information
adlered committed Nov 4, 2024
1 parent 19d1814 commit b92ca0b
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 28 deletions.
10 changes: 9 additions & 1 deletion src/main/java/org/b3log/symphony/processor/AdminProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,14 @@ public void markPic(final RequestContext context) {
uploadRepository.update(oId, status);
transaction.commit();

if ("normal".equals(type)) {
final String transferId = pointtransferMgmtService.transfer(Pointtransfer.ID_C_SYS, userId,
Pointtransfer.TRANSFER_TYPE_C_ACCOUNT2ACCOUNT, 8, oId, System.currentTimeMillis(), "参与图片审核奖励:正常图片");
context.renderJSON(StatusCodes.SUCC);
context.renderMsg("审核成功,奖励已发放!");
return;
}

// 删除图片
if (QN_ENABLED) {
Auth auth = Auth.create(Symphonys.UPLOAD_QINIU_AK, Symphonys.UPLOAD_QINIU_SK);
Expand All @@ -481,7 +489,7 @@ public void markPic(final RequestContext context) {
// 奖惩
if ("temp".equals(type)) {
final String transferId = pointtransferMgmtService.transfer(Pointtransfer.ID_C_SYS, userId,
Pointtransfer.TRANSFER_TYPE_C_ACCOUNT2ACCOUNT, 8, oId, System.currentTimeMillis(), "参与图片审核奖励:临时图片");
Pointtransfer.TRANSFER_TYPE_C_ACCOUNT2ACCOUNT, 16, oId, System.currentTimeMillis(), "参与图片审核奖励:临时图片");
} else if ("illegal".equals(type)) {
final String transferId = pointtransferMgmtService.transfer(Pointtransfer.ID_C_SYS, userId,
Pointtransfer.TRANSFER_TYPE_C_ACCOUNT2ACCOUNT, 128, oId, System.currentTimeMillis(), "参与图片审核奖励:违规图片");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,10 @@ public synchronized void uploadFile(final RequestContext context) {
for (int i = 0; i < files.size(); i++) {
// 检查该文件是否已经上传过
String md5 = MD5Calculator.calculateMd5(fileBytes.get(i));
final Query query = new Query().setFilter(new PropertyFilter("md5", FilterOperator.EQUAL, md5));
final List<Filter> filters = new ArrayList<>();
filters.add(new PropertyFilter("md5", FilterOperator.EQUAL, md5));
filters.add(new PropertyFilter("public", FilterOperator.EQUAL, true));
final Query query = new Query().setFilter(new CompositeFilter(CompositeFilterOperator.AND, filters));
try {
final List<JSONObject> md5s = uploadRepository.getList(query);
if (!md5s.isEmpty()) {
Expand Down
33 changes: 20 additions & 13 deletions src/main/resources/skins/classic/admin/pic.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@
<div>
<h3>审前必读</h3>
<p>1. 您的审核将被记录</p>
<p>2. 临时图片:未出现在帖子、帖子回复下的临时图片:例如截图是最常见的。这一类图片可以从图床删除以节约摸鱼派的存储资源,删除此类图片您将获得8积分奖励,但不处罚、不通知用户</p>
<p>2. 临时图片:未出现在帖子、帖子回复下的临时图片:例如截图是最常见的。这一类图片可以从图床删除以节约摸鱼派的存储资源,删除此类图片您将获得16积分奖励,但不处罚、不通知用户</p>
<p>3. 违规图片:如涉及政治、色情、违法等违规图片,请及时删除,删除后您将获得128积分奖励,同时用户将被除以500积分的处罚,并通知用户</p>
<p>4. 正常图片:以后会被翻出来看,有用并且合法的图片,标记后您将获得8积分奖励</p>
</div>
<br>
<div class="file__items fn__clear">
Expand All @@ -56,7 +57,8 @@
<#if file.public == true>
<span style="position: absolute; left: 5px; bottom: 5px">
<button class="btn red" onclick="mark('${file.oId}', 'temp')">标记为临时图片</button><br>
<button class="btn red" onclick="mark('${file.oId}', 'illegal')">标记为违规图片</button>
<button class="btn red" onclick="mark('${file.oId}', 'illegal')">标记为违规图片</button><br>
<button class="btn green" style="margin-top: 8px" onclick="mark('${file.oId}', 'normal')">标记为正常图片</button>
</span>
<#else>
<span style="position: absolute; left: 5px; bottom: 5px">
Expand All @@ -76,18 +78,23 @@
</div>
<script>
function mark(oId, type) {
$.ajax({
url: "${servePath}/admin/pic",
type: "POST",
data: {
oId: oId,
type: type
},
success: function (result) {
Util.notice("success", 1500, result.msg);
$("#" + oId).find("span")[0].innerHTML = '<button disabled class="btn" onclick="javascript:void(0)">该图片已被审核过</button><br>';
if (type == "temp") {
if (confirm("请确定这张图片不是表情包、没有引用在帖子或评论里\n如果它是聊天室里随意发送的一张截图,不会再有人看了,或者干脆就是无效内容,请删除它\n请再次确认!多次无效审核将会影响你的工资!")) {
$.ajax({
url: "${servePath}/admin/pic",
type: "POST",
async: true,
data: {
oId: oId,
type: type
},
success: function (result) {
Util.notice("success", 1500, result.msg);
$("#" + oId).find("span")[0].innerHTML = '<button disabled class="btn" onclick="javascript:void(0)">该图片已被审核过</button><br>';
}
});
}
});
}
}
</script>
</@admin>
33 changes: 20 additions & 13 deletions src/main/resources/skins/mobile/admin/pic.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@
<div>
<h3>审前必读</h3>
<p>1. 您的审核将被记录</p>
<p>2. 临时图片:未出现在帖子、帖子回复下的临时图片:例如截图是最常见的。这一类图片可以从图床删除以节约摸鱼派的存储资源,删除此类图片您将获得8积分奖励,但不处罚、不通知用户</p>
<p>2. 临时图片:未出现在帖子、帖子回复下的临时图片:例如截图是最常见的。这一类图片可以从图床删除以节约摸鱼派的存储资源,删除此类图片您将获得16积分奖励,但不处罚、不通知用户</p>
<p>3. 违规图片:如涉及政治、色情、违法等违规图片,请及时删除,删除后您将获得128积分奖励,同时用户将被除以500积分的处罚,并通知用户</p>
<p>4. 正常图片:以后会被翻出来看,有用并且合法的图片,标记后您将获得8积分奖励</p>
</div>
<br>
<div class="file__items fn__clear">
Expand All @@ -52,7 +53,8 @@
<#if file.public == true>
<span style="position: absolute; left: 5px; bottom: 5px">
<button class="btn red" onclick="mark('${file.oId}', 'temp')">标记为临时图片</button><br>
<button class="btn red" onclick="mark('${file.oId}', 'illegal')">标记为违规图片</button>
<button class="btn red" onclick="mark('${file.oId}', 'illegal')">标记为违规图片</button><br>
<button class="btn green" style="margin-top: 8px" onclick="mark('${file.oId}', 'normal')">标记为正常图片</button>
</span>
<#else>
<span style="position: absolute; left: 5px; bottom: 5px">
Expand All @@ -72,18 +74,23 @@
</div>
<script>
function mark(oId, type) {
$.ajax({
url: "${servePath}/admin/pic",
type: "POST",
data: {
oId: oId,
type: type
},
success: function (result) {
Util.notice("success", 1500, result.msg);
$("#" + oId).find("span")[0].innerHTML = '<button disabled class="btn" onclick="javascript:void(0)">该图片已被审核过</button><br>';
if (type == "temp") {
if (confirm("请确定这张图片不是表情包、没有引用在帖子或评论里\n如果它是聊天室里随意发送的一张截图,不会再有人看了,或者干脆就是无效内容,请删除它\n请再次确认!多次无效审核将会影响你的工资!")) {
$.ajax({
url: "${servePath}/admin/pic",
type: "POST",
async: true,
data: {
oId: oId,
type: type
},
success: function (result) {
Util.notice("success", 1500, result.msg);
$("#" + oId).find("span")[0].innerHTML = '<button disabled class="btn" onclick="javascript:void(0)">该图片已被审核过</button><br>';
}
});
}
});
}
}
</script>
</@admin>

0 comments on commit b92ca0b

Please sign in to comment.