修正帖子通过的通知 #191

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

@ -157,9 +157,9 @@ public class NoticeService {
Map<String, Object> lastMessage = recentMessages.get(0);
java.sql.Timestamp lastCreatedAt = (java.sql.Timestamp) lastMessage.get("created_at");
// 如果最后一条消息是在1秒内发送的,且内容相同,则跳过
// 如果最后一条消息是在5秒内发送的,且内容相同,则跳过
if (lastCreatedAt != null
&& (now.getTime() - lastCreatedAt.getTime()) < 1000
&& (now.getTime() - lastCreatedAt.getTime()) < 5000
&& content.equals(lastMessage.get("content"))) {
System.out.println("⚠️ 跳过重复通知: userId=" + userId + ", type=" + messageType);
return;

@ -15,6 +15,19 @@ import {
searchPosts as apiSearchPosts
} from '../api/posts.js'
//
const debounce = (func, wait = 1000) => {
let timeout
return function executedFunction(...args) {
const later = () => {
clearTimeout(timeout)
func(...args)
}
clearTimeout(timeout)
timeout = setTimeout(later, wait)
}
}
const searchQuery = ref('')
const pendingSearchQuery = ref('') //
const reviewedSearchQuery = ref('') //
@ -643,8 +656,8 @@ const handleStopAiReview = async () => {
}
}
//
const handleApprovePost = async (postId) => {
//
const handleApprovePostOriginal = async (postId) => {
try {
const response = await apiApprovePost(postId)
if (response.success) {
@ -674,6 +687,9 @@ const handleApprovePost = async (postId) => {
}
}
//
const handleApprovePost = debounce(handleApprovePostOriginal, 1000)
//
const handleRejectPost = async (postId) => {
try {
@ -705,8 +721,8 @@ const handleRejectPost = async (postId) => {
}
}
//
const togglePostStatus = async (post) => {
//
const togglePostStatusOriginal = async (post) => {
try {
if (post.status === 'published') {
const response = await apiRejectPost(post.id, '管理员修改状态')
@ -769,6 +785,9 @@ const togglePostStatus = async (post) => {
}
}
//
const togglePostStatus = debounce(togglePostStatusOriginal, 1000)
// -
const resetPendingSearch = () => {
pendingSearchQuery.value = ''

Loading…
Cancel
Save