修正糖友圈发布管理 #153

Merged
hnu202326010221 merged 6 commits from pangqr_branch into develop 4 months ago

@ -32,6 +32,9 @@ public class PostReportController {
@Autowired
private PostReportSearchService postReportSearchService;
@Autowired
private com.service.admin.Mapper.AdminMapper adminMapper;
/**
* ()
@ -164,23 +167,23 @@ public class PostReportController {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Timestamp createdAt = new Timestamp(sdf.parse(createdAtStr).getTime());
// 更新数据库 - 状态改为dismissed,result标记为"恶意举报"
// 更新数据库 - 状态改为reviewed(举报成立)
boolean updated = postReportService.updateReportStatus(
reporterId,
postId,
createdAt,
"dismissed", // 状态改为已驳回
"reviewed", // 状态改为已审核(举报成立)
1L, // 审核人ID
"恶意举报" // result字段标记为恶意举报
reason // 处理原因
);
if (updated) {
response.put("success", true);
response.put("message", "已判定为恶意举报并驳回");
response.put("message", "举报已处理,帖子已封禁");
response.put("reportId", reportId);
response.put("action", "malicious");
response.put("status", "dismissed");
response.put("result", "恶意举报");
response.put("action", "reviewed");
response.put("status", "reviewed");
response.put("result", "已封禁帖子");
} else {
response.put("success", false);
response.put("message", "未找到匹配的举报记录");
@ -302,14 +305,29 @@ public class PostReportController {
detailInfo.put("reporterInfo", reporterInfo);
}
// 如果是已处理的举报,添加处理信息
// 🔧 修复:如果是已处理的举报,添加处理信息(去掉处理依据,添加管理员真实姓名)
if (!"pending".equals(report.getStatus())) {
detailInfo.put("processor", report.getReviewedBy() != null ?
"管理员" + report.getReviewedBy() : "系统管理员");
// 获取管理员真实姓名
String processorName = "系统管理员";
if (report.getReviewedBy() != null) {
try {
com.service.admin.model.Administrator admin = adminMapper.selectById(report.getReviewedBy());
if (admin != null && admin.getName() != null) {
processorName = "管理员" + report.getReviewedBy() + "-" + admin.getName();
} else {
processorName = "管理员" + report.getReviewedBy();
}
} catch (Exception e) {
System.err.println("获取管理员信息失败: " + e.getMessage());
processorName = "管理员" + report.getReviewedBy();
}
}
detailInfo.put("processor", processorName);
detailInfo.put("processedAt", report.getProcessedAt() != null ?
sdf.format(report.getProcessedAt()) : "-");
detailInfo.put("handleResult", report.getResult() != null ? report.getResult() : "已处理");
detailInfo.put("basis", report.getResult() != null ? report.getResult() : "情况属实");
// 🔧 不再添加 basis 字段(处理依据)
}
return detailInfo;

@ -187,12 +187,17 @@ public class PostReportSearchService {
Query boolQuery = Query.of(q -> q.bool(boolBuilder.build()));
// 根据状态选择排序字段
// 待处理举报:按创建时间排序
// 历史举报:按处理时间排序
String sortField = "pending".equals(status) ? "created_at" : "processed_at";
SearchRequest request = SearchRequest.of(s -> s
.index(INDEX_NAME)
.query(boolQuery)
.from(page * size)
.size(size)
.sort(sort -> sort.field(f -> f.field("created_at").order(SortOrder.Desc)))
.sort(sort -> sort.field(f -> f.field(sortField).order(SortOrder.Desc)))
);
SearchResponse<Map> response = elasticsearchClient.search(request, Map.class);
@ -329,16 +334,24 @@ public class PostReportSearchService {
result.put("reportedId", String.valueOf(postId));
result.put("reason", source.get("report_type") != null ? source.get("report_type").toString() : "其他");
result.put("reasonDetail", source.get("description") != null ? source.get("description").toString() : "");
result.put("submitTime", createdAt);
String status = source.get("status") != null ? source.get("status").toString() : "pending";
result.put("status", "pending".equals(status) ? "pending" : "processed");
// 根据状态显示不同的时间
// 待处理举报显示提交时间created_at
// 历史举报显示处理时间processed_at
if (!"pending".equals(status)) {
// 历史举报:优先使用 processed_at如果为空则使用 created_at
String processedAt = source.get("processed_at") != null ? source.get("processed_at").toString() : "";
result.put("submitTime", !processedAt.isEmpty() ? processedAt : createdAt);
result.put("handleResult", source.get("result") != null ? source.get("result").toString() : "已处理");
result.put("processedAt", source.get("processed_at") != null ? source.get("processed_at").toString() : "");
result.put("processedAt", processedAt);
result.put("processor", source.get("reviewed_by") != null ?
"管理员" + source.get("reviewed_by") : "系统管理员");
} else {
// 待处理举报:显示提交时间
result.put("submitTime", createdAt);
}
return result;

@ -97,10 +97,10 @@ public interface PostMapper {
// ==================== 帖子审核相关方法 ====================
/**
* IDPost
* IDPost
*/
@Select("SELECT p.id, p.content, p.images, p.visibility, p.status, p.author_id, " +
"p.created_at, p.approved_at, p.reviewed_by, p.reject_reason, " +
"p.created_at, p.approved_at, p.reviewed_by, p.reject_reason, p.review_type, " +
"(SELECT COUNT(*) FROM interactions WHERE post_id = p.id) as comments_count " +
"FROM posts p WHERE p.id = #{postId}")
@Results(id = "PostResultMap", value = {
@ -113,6 +113,7 @@ public interface PostMapper {
@Result(property = "approved_at", column = "approved_at"),
@Result(property = "reviewed_by", column = "reviewed_by"),
@Result(property = "reject_reason", column = "reject_reason"),
@Result(property = "review_type", column = "review_type"),
@Result(property = "comments_count", column = "comments_count")
})
Post selectByIdAsPost(@Param("postId") Long postId);
@ -121,7 +122,7 @@ public interface PostMapper {
*
*/
@Select("SELECT p.id, p.content, p.images, p.visibility, p.status, p.author_id, " +
"p.created_at, p.approved_at, p.reviewed_by, p.reject_reason, " +
"p.created_at, p.approved_at, p.reviewed_by, p.reject_reason, p.review_type, " +
"(SELECT COUNT(*) FROM interactions WHERE post_id = p.id) as comments_count " +
"FROM posts p " +
"WHERE p.status = 'pending' " +
@ -134,13 +135,13 @@ public interface PostMapper {
* -
*/
@Select("SELECT p.id, p.content, p.images, p.visibility, p.status, p.author_id, " +
"p.created_at, p.approved_at, p.reviewed_by, p.reject_reason, " +
"p.created_at, p.approved_at, p.reviewed_by, p.reject_reason, p.review_type, " +
"u.username as user_name, u.avatar_url as user_avatar, " +
"(SELECT COUNT(*) FROM interactions WHERE post_id = p.id) as comments_count " +
"FROM posts p " +
"LEFT JOIN users u ON p.author_id = u.id " +
"WHERE p.status = 'pending' " +
"ORDER BY p.created_at DESC " +
"ORDER BY p.created_at ASC " +
"LIMIT #{limit} OFFSET #{offset}")
@ResultMap("PostResultMap")
List<Post> selectPendingPostsWithUserInfo(@Param("offset") int offset, @Param("limit") int limit);
@ -158,10 +159,8 @@ public interface PostMapper {
"UPDATE posts SET " +
"status = #{status}, " +
"reviewed_by = #{adminId}, " +
"approved_at = #{approvedAt}" +
"<if test='rejectReason != null'>" +
", reject_reason = #{rejectReason}" +
"</if> " +
"approved_at = #{approvedAt}, " +
"reject_reason = #{rejectReason}" +
"<if test='reviewType != null'>" +
", review_type = #{reviewType}" +
"</if> " +
@ -178,7 +177,7 @@ public interface PostMapper {
*
*/
@Select("SELECT p.id, p.content, p.images, p.visibility, p.status, p.author_id, " +
"p.created_at, p.approved_at, p.reviewed_by, p.reject_reason, " +
"p.created_at, p.approved_at, p.reviewed_by, p.reject_reason, p.review_type, " +
"(SELECT COUNT(*) FROM interactions WHERE post_id = p.id) as comments_count " +
"FROM posts p " +
"WHERE p.status IN ('approved', 'rejected') " +
@ -208,7 +207,7 @@ public interface PostMapper {
*
*/
@Select("SELECT p.id, p.content, p.images, p.visibility, p.status, p.author_id, " +
"p.created_at, p.approved_at, p.reviewed_by, p.reject_reason, " +
"p.created_at, p.approved_at, p.reviewed_by, p.reject_reason, p.review_type, " +
"(SELECT COUNT(*) FROM interactions WHERE post_id = p.id) as comments_count " +
"FROM posts p " +
"WHERE p.status = #{status} " +
@ -321,7 +320,14 @@ public interface PostMapper {
"AND p.status IN ('approved', 'rejected') " +
"</otherwise>" +
"</choose>" +
"<choose>" +
"<when test='status == \"pending\"'>" +
"ORDER BY p.created_at DESC " +
"</when>" +
"<otherwise>" +
"ORDER BY p.approved_at DESC " +
"</otherwise>" +
"</choose>" +
"LIMIT #{limit} OFFSET #{offset}" +
"</script>")
@ResultMap("PostResultMap")
@ -500,7 +506,14 @@ public interface PostMapper {
"AND p.status IN ('approved', 'rejected') " +
"</otherwise>" +
"</choose>" +
"ORDER BY p.created_at DESC " +
"<choose>" +
"<when test='status == \"pending\"'>" +
"ORDER BY p.created_at ASC " +
"</when>" +
"<otherwise>" +
"ORDER BY p.approved_at DESC " +
"</otherwise>" +
"</choose>" +
"LIMIT #{limit} OFFSET #{offset}" +
"</script>")
@ResultMap("PostResultMap")

@ -17,9 +17,19 @@ public interface ReportPostMapper {
*
* @param status : pending, reviewed, dismissed
*/
@Select("SELECT reporter_id, post_id, report_type, description, status, " +
@Select("<script>" +
"SELECT reporter_id, post_id, report_type, description, status, " +
"reviewed_by, processed_at, created_at, result " +
"FROM reports_posts WHERE status = #{status} ORDER BY created_at DESC")
"FROM reports_posts WHERE status = #{status} " +
"<choose>" +
"<when test='status == \"pending\"'>" +
"ORDER BY created_at DESC " +
"</when>" +
"<otherwise>" +
"ORDER BY processed_at DESC " +
"</otherwise>" +
"</choose>" +
"</script>")
@Results({
@Result(property = "reporterId", column = "reporter_id"),
@Result(property = "postId", column = "post_id"),
@ -178,7 +188,14 @@ public interface ReportPostMapper {
" </otherwise>" +
" </choose>" +
"</if>" +
"<choose>" +
"<when test='status == \"pending\"'>" +
"ORDER BY created_at DESC " +
"</when>" +
"<otherwise>" +
"ORDER BY processed_at DESC " +
"</otherwise>" +
"</choose>" +
"LIMIT #{offset}, #{limit}" +
"</script>")
@Results({

@ -110,6 +110,9 @@ public class NoticeService {
/**
*
* @param reporterId ID
* @param postId ID
* @param result "已封禁帖子" "已驳回举报"
*/
public void sendPostReportResultNotification(Long reporterId, Long postId, String result) {
String content = String.format("您举报的帖子已处理完成\n处理结果%s", result);
@ -117,13 +120,41 @@ public class NoticeService {
}
/**
*
*
*
* @param authorId ID
* @param postId ID
* @param reportType
*/
public void sendPostReportedNotification(Long authorId, Long postId, String reportType) {
String content = String.format("您的帖子被举报\n举报类型%s\n我们将尽快处理", reportType);
public void sendPostBannedByReportNotification(Long authorId, Long postId, String reportType) {
String content = String.format("您的帖子因举报被封禁\n举报类型%s\n如有疑问请联系管理员", reportType);
// 使用现有的 post_reported 类型数据库ENUM限制
sendSystemMessage(authorId, "post_reported", content);
}
/**
*
* rejected approved
* @param authorId ID
* @param postId ID
*/
public void sendPostReportDismissedNotification(Long authorId, Long postId) {
String content = String.format("好消息!您的帖子举报已被驳回\n帖子已恢复正常显示");
// 使用现有的 post_report_result 类型数据库ENUM限制
sendSystemMessage(authorId, "post_report_result", content);
}
/**
*
* sendPostBannedByReportNotification
* 使
* @deprecated 使 sendPostBannedByReportNotification
*/
@Deprecated
public void sendPostReportedNotification(Long authorId, Long postId, String reportType) {
sendPostBannedByReportNotification(authorId, postId, reportType);
}
/**
*
*/

@ -332,7 +332,7 @@ public class PostAdminSearchService {
.query(finalQuery)
.from(page * size)
.size(size)
// 移除排序,避免字段类型问题
.sort(sort -> sort.field(f -> f.field("created_at").order(co.elastic.clients.elasticsearch._types.SortOrder.Asc)))
);
SearchResponse<PostDocument> response = elasticsearchClient.search(request, PostDocument.class);

@ -89,11 +89,20 @@ public class PostReportService {
* @param createdAt
* @param status reviewed(), dismissed()
* @param reviewedBy ID
* @param result
* @param result
* @return
*/
public boolean updateReportStatus(Long reporterId, Long postId, Timestamp createdAt,
String status, Long reviewedBy, String result) {
// 🎯 标准化 result 字段:只有两种情况
String standardizedResult;
if ("reviewed".equals(status)) {
// 举报成立 -> 统一显示"已封禁帖子"
standardizedResult = "已封禁帖子";
} else {
// 举报驳回 -> 统一显示"已驳回举报"
standardizedResult = "已驳回举报";
}
SqlSession sqlSession = null;
try {
sqlSession = sqlSessionFactory.openSession();
@ -104,15 +113,28 @@ public class PostReportService {
PostMapper postMapper = sqlSession.getMapper(PostMapper.class);
Post post = postMapper.selectByIdAsPost(postId);
// 更新举报状态
int rows = mapper.updateReportStatus(reporterId, postId, createdAt, status, reviewedBy, result);
// 更新举报状态使用标准化的result
int rows = mapper.updateReportStatus(reporterId, postId, createdAt, status, reviewedBy, standardizedResult);
// 判断是举报成立还是驳回
boolean isReportApproved = "reviewed".equals(status) ||
("dismissed".equals(status) && "恶意举报".equals(result));
// 判断是否为驳回举报非恶意举报的dismissed
boolean isReportDismissed = "dismissed".equals(status) && !"恶意举报".equals(result);
boolean isReportApproved = "reviewed".equals(status);
boolean isReportDismissed = "dismissed".equals(status);
// 🎯 记录帖子原始状态和 review_type用于后续判断
String originalPostStatus = post != null ? post.getStatus().toString() : null;
String originalReviewType = post != null ? post.getReview_type() : null;
System.out.println("=== 举报处理开始 ===");
System.out.println("举报状态: " + status);
System.out.println("是否举报成立: " + isReportApproved);
System.out.println("是否驳回举报: " + isReportDismissed);
System.out.println("帖子是否存在: " + (post != null));
if (post != null) {
System.out.println("帖子ID: " + postId);
System.out.println("帖子当前状态: " + originalPostStatus);
System.out.println("帖子review_type: " + originalReviewType);
}
System.out.println("==================");
// 如果举报成立,需要更新帖子状态为 rejected
if (isReportApproved && post != null) {
@ -146,34 +168,43 @@ public class PostReportService {
// 不影响主流程,继续执行
}
}
// 如果驳回举报且帖子当前是rejected状态可能是之前误判需要恢复为approved
else if (isReportDismissed && post != null && post.getStatus() == Post.Status.rejected) {
try {
System.out.println("=== 驳回举报 - 恢复帖子状态为approved ===");
System.out.println("帖子ID: " + postId);
System.out.println("当前状态: " + post.getStatus());
System.out.println("新状态: approved");
System.out.println("原因: 重新审核后发现举报不成立,恢复帖子");
// 恢复帖子状态为 approved
int postRows = postMapper.updatePostStatus(
postId,
Post.Status.approved,
reviewedBy,
new Timestamp(System.currentTimeMillis()),
null, // 清空拒绝原因
"report_review_reversed" // 标记为举报审核撤销
);
if (postRows > 0) {
System.out.println("✅ 帖子状态恢复为approved成功");
} else {
System.out.println("⚠️ 帖子状态恢复失败");
// 🎯 新增:驳回举报时,如果帖子是因举报被封禁的,则恢复帖子状态
if (isReportDismissed && post != null) {
// 检查帖子是否是因为举报被封禁的状态为rejected且review_type为report_review
if ("rejected".equals(originalPostStatus) && "report_review".equals(originalReviewType)) {
try {
System.out.println("=== 驳回举报 - 恢复因举报被封禁的帖子 ===");
System.out.println("帖子ID: " + postId);
System.out.println("原状态: rejected (review_type: report_review)");
System.out.println("新状态: approved (恢复帖子)");
// 恢复帖子状态为 approved
int postRows = postMapper.updatePostStatus(
postId,
Post.Status.approved,
reviewedBy,
new Timestamp(System.currentTimeMillis()),
"举报已驳回,帖子恢复正常",
"report_dismissed" // 新的 review_type表示因驳回举报而恢复
);
if (postRows > 0) {
System.out.println("✅ 帖子状态已恢复为 approved");
} else {
System.out.println("⚠️ 帖子状态恢复失败");
}
} catch (Exception e) {
System.err.println("❌ 恢复帖子状态失败: " + e.getMessage());
e.printStackTrace();
// 不影响主流程,继续执行
}
} catch (Exception e) {
System.err.println("❌ 恢复帖子状态失败: " + e.getMessage());
e.printStackTrace();
// 不影响主流程,继续执行
} else {
System.out.println("=== 驳回举报 - 帖子状态保持不变 ===");
System.out.println("帖子ID: " + postId);
System.out.println("当前状态: " + originalPostStatus);
System.out.println("review_type: " + originalReviewType);
System.out.println("原因: 帖子不是因举报被封禁,保持原状态");
}
}
@ -202,71 +233,94 @@ public class PostReportService {
}
}
// 如果举报成立或驳回举报且帖子状态有变化同步帖子到ES索引
if (success && (isReportApproved || isReportDismissed) && post != null && postAdminSearchService != null) {
try {
System.out.println("=== 同步帖子状态到ES ===");
System.out.println("帖子ID: " + postId);
// 重新获取更新后的帖子信息
Post updatedPost = postMapper.selectByIdAsPost(postId);
if (updatedPost != null) {
postAdminSearchService.updatePost(updatedPost);
System.out.println("✅ 帖子ES索引更新成功");
// 🎯 修改同步帖子到ES索引举报成立或驳回举报恢复帖子时都需要同步
if (success && post != null && postAdminSearchService != null) {
// 举报成立时需要同步帖子变为rejected
// 驳回举报且帖子被恢复时也需要同步帖子从rejected变为approved
boolean needSync = isReportApproved ||
(isReportDismissed && "rejected".equals(originalPostStatus) &&
"report_review".equals(originalReviewType));
if (needSync) {
try {
System.out.println("=== 同步帖子状态到ES ===");
System.out.println("帖子ID: " + postId);
// 重新获取更新后的帖子信息
Post updatedPost = postMapper.selectByIdAsPost(postId);
if (updatedPost != null) {
postAdminSearchService.updatePost(updatedPost);
System.out.println("✅ 帖子ES索引更新成功");
}
} catch (Exception e) {
System.err.println("❌ 帖子ES索引更新失败: " + e.getMessage());
e.printStackTrace();
// ES更新失败不影响主流程
}
} catch (Exception e) {
System.err.println("❌ 帖子ES索引更新失败: " + e.getMessage());
e.printStackTrace();
// ES更新失败不影响主流程
}
}
// 发送通知
// 🎯 修改:发送通知(根据不同场景发送不同通知)
if (success && report != null) {
try {
System.out.println("=== 帖子举报通知 ===");
System.out.println("举报人ID: " + reporterId);
System.out.println("帖子ID: " + postId);
System.out.println("处理状态: " + status);
System.out.println("处理结果: " + result);
// 判断是举报成立还是驳回(使用前面已定义的变量)
// reviewed = 举报成立,需要通知举报人和帖子作者
// dismissed + "恶意举报" = 举报成立(帖子内容恶意),需要通知举报人和帖子作者
// dismissed + 其他 = 举报驳回,只通知举报人
System.out.println("原帖子状态: " + originalPostStatus);
System.out.println("原review_type: " + originalReviewType);
if (isReportApproved) {
// 举报成立:通知举报人和帖子作者
System.out.println("举报成立 - 通知举报人和帖子作者");
// ========== 场景1举报成立 ==========
System.out.println("📢 场景1举报成立");
// 通知举报人
// 1. 通知举报人:举报成立
noticeService.sendPostReportResultNotification(
reporterId,
postId,
"举报成立,已处理"
"已封禁帖子"
);
System.out.println("发送通知举报人: " + reporterId);
System.out.println("已通知举报人ID:" + reporterId + "):举报成立");
// 通知帖子作者
// 2. 通知帖子作者:帖子因举报被封禁
if (post != null) {
String reportType = report.getReportType() != null ? report.getReportType() : "违规内容";
noticeService.sendPostReportedNotification(
noticeService.sendPostBannedByReportNotification(
post.getAuthor_id(),
postId,
reportType
);
System.out.println("发送通知帖子作者: " + post.getAuthor_id());
System.out.println("已通知帖子作者ID:" + post.getAuthor_id() + "):帖子因举报被封禁");
}
} else {
// 举报驳回:只通知举报人
System.out.println("举报驳回 - 只通知举报人");
} else if (isReportDismissed) {
// ========== 场景2/3举报驳回 ==========
// 总是通知举报人:举报被驳回
noticeService.sendPostReportResultNotification(
reporterId,
postId,
result != null ? result : "举报不成立,已驳回"
"已驳回举报"
);
System.out.println("已发送通知给举报人: " + reporterId);
System.out.println("✅ 已通知举报人ID:" + reporterId + "):举报被驳回");
// 判断是否需要通知帖子作者
if (post != null && "rejected".equals(originalPostStatus) &&
"report_review".equals(originalReviewType)) {
// ========== 场景2帖子是因举报被封禁的现在恢复了 ==========
System.out.println("📢 场景2帖子因举报被封禁现已恢复");
noticeService.sendPostReportDismissedNotification(
post.getAuthor_id(),
postId
);
System.out.println("✅ 已通知帖子作者ID:" + post.getAuthor_id() + "):举报被驳回,帖子已恢复");
} else {
// ========== 场景3帖子不是因举报被封禁的或本来就正常 ==========
System.out.println("📢 场景3帖子状态保持不变不通知作者");
System.out.println(" 原因帖子不是因举报被封禁status:" + originalPostStatus + ", review_type:" + originalReviewType + "");
}
}
System.out.println("===================");
@ -318,6 +372,26 @@ public class PostReportService {
}
}
// 对历史举报processed状态按处理时间降序排序
// 确保最新处理的举报在前面
allReports.sort((a, b) -> {
String statusA = (String) a.get("status");
String statusB = (String) b.get("status");
// 如果都是processed状态按submitTime实际是processedAt降序排序
if ("processed".equals(statusA) && "processed".equals(statusB)) {
String timeA = (String) a.get("submitTime");
String timeB = (String) b.get("submitTime");
// 降序B比A如果B更晚则返回正数
return timeB.compareTo(timeA);
}
// 保持pending在前processed在后
if ("pending".equals(statusA)) return -1;
if ("pending".equals(statusB)) return 1;
return 0;
});
// 统计
long pendingCount = allReports.stream()
.filter(r -> "pending".equals(r.get("status")))
@ -519,7 +593,28 @@ public class PostReportService {
reportMap.put("reportedId", String.valueOf(report.getPostId()));
reportMap.put("reason", report.getReportType() != null ? report.getReportType() : "其他");
reportMap.put("reasonDetail", report.getDescription());
reportMap.put("submitTime", report.getCreatedAt() != null ? sdf.format(report.getCreatedAt()) : "-");
// 🔧 修复:始终保留原始的 created_at 用于查询详情
reportMap.put("createdAt", report.getCreatedAt() != null ?
sdf.format(report.getCreatedAt()) : "-");
// 根据状态显示不同的时间
// 待处理举报显示提交时间created_at
// 历史举报显示处理时间processed_at
if ("processed".equals(status)) {
// 历史举报:优先使用 processed_at如果为空则使用 created_at
String timeToDisplay = "-";
if (report.getProcessedAt() != null) {
timeToDisplay = sdf.format(report.getProcessedAt());
} else if (report.getCreatedAt() != null) {
timeToDisplay = sdf.format(report.getCreatedAt());
}
reportMap.put("submitTime", timeToDisplay);
} else {
reportMap.put("submitTime", report.getCreatedAt() != null ?
sdf.format(report.getCreatedAt()) : "-");
}
reportMap.put("status", status);
// 如果是已处理的举报,添加处理信息

@ -337,20 +337,21 @@ const handleResolveReportFromHistory = async (report) => {
loading.value = true
try {
console.log('🔄 从历史记录重新审核 - 处理举报:', report)
console.log('🔄 从历史记录重新审核 - 处理举报(举报成立):', report)
// 🔧 使 createdAt
const requestData = {
reason: '重新审核后判定为恶意举报',
reason: '重新审核后判定举报成立',
reporterId: report.reporterId,
reportedId: report.reportedId,
createdAt: report.submitTime
createdAt: report.createdAt || report.submitTime // 使 createdAt
}
const response = await markAsMalicious(report.id, requestData)
if (response.success) {
console.log('✅ 重新审核成功')
showSuccessToast('重新审核完成:已判定为恶意举报')
console.log('✅ 重新审核成功,帖子已封禁')
showSuccessToast('重新审核完成:举报成立,帖子已封禁')
//
await loadReports()
@ -375,11 +376,12 @@ const handleRejectReportFromHistory = async (report) => {
try {
console.log('🔄 从历史记录重新审核 - 驳回举报:', report)
// 🔧 使 createdAt
const requestData = {
reason: '重新审核后驳回',
reporterId: report.reporterId,
reportedId: report.reportedId,
createdAt: report.submitTime
createdAt: report.createdAt || report.submitTime // 使 createdAt
}
const response = await rejectReport(report.id, requestData)
@ -446,15 +448,15 @@ const handleRejectReport = async (report) => {
}
}
//
//
const handleResolveReport = async (report) => {
loading.value = true
try {
console.log('🔄 开始判定恶意举报:', report)
console.log('🔄 开始处理举报(举报成立):', report)
const requestData = {
reason: '判定为恶意举报',
reason: '举报成立,封禁帖子',
reporterId: report.reporterId,
reportedId: report.reportedId,
createdAt: report.submitTime
@ -463,8 +465,8 @@ const handleResolveReport = async (report) => {
const response = await markAsMalicious(report.id, requestData)
if (response.success) {
console.log('✅ 恶意举报判定成功')
showSuccessToast('已判定为恶意举报')
console.log('✅ 举报处理成功,帖子已封禁')
showSuccessToast('举报已处理,帖子已封禁')
//
await loadReports()
@ -615,11 +617,12 @@ const viewReportDetail = async (report) => {
try {
console.log('🔄 开始获取举报详情:', report)
// IDID
// 🔧 使 createdAt submitTime
// submitTime
const params = {
reporterId: report.reporterId,
reportedId: report.reportedId,
createdAt: report.submitTime
createdAt: report.createdAt || report.submitTime // 使 createdAt
}
console.log('📤 请求参数:', params)
@ -821,7 +824,7 @@ const closeModal = () => {
<th style="width: 100px;">帖子ID</th>
<th style="width: 120px;">举报理由</th>
<th style="width: 80px;">举报详情</th>
<th style="width: 140px;">提交时间</th>
<th style="width: 140px;">处理时间</th>
<th style="width: 120px;">处理结果</th>
<th style="width: 100px;">操作</th>
</tr>
@ -856,7 +859,9 @@ const closeModal = () => {
</div>
</td>
<td>
<div class="handle-result">{{ item.handleResult }}</div>
<div class="time-info">
<div class="time">{{ item.handleResult }}</div>
</div>
</td>
<td>
<div class="action-buttons">
@ -1122,10 +1127,6 @@ const closeModal = () => {
</span>
</div>
</div>
<div class="detail-item-full">
<span class="detail-label">处理依据:</span>
<div class="detail-content-box">{{ currentReportDetail.basis }}</div>
</div>
</div>
</div>
<div class="modal-footer">

@ -707,6 +707,7 @@ Page({
onPullDownRefresh: function () {
this.loadFeeds();
this.checkUnreadNotices();
},
onReachBottom: function () {

Loading…
Cancel
Save