BUGFIX: 视频生成完成后,站内信通知

This commit is contained in:
2025-11-18 13:31:18 +08:00
parent 2f3fa695b2
commit 604c529b42

View File

@@ -188,7 +188,7 @@ public class MessageCenterServiceImpl extends ServiceImpl<NotificationMapper, No
ArrayList<Map<String, Object>> resp = new ArrayList<>(); ArrayList<Map<String, Object>> resp = new ArrayList<>();
HashMap<String, Object> data = new HashMap<>(); HashMap<String, Object> data = new HashMap<>();
Long count; Long count;
if (!type.equals("system")) { if (!type.equals("system") || Objects.nonNull(receiverId)) {
// 个人未读消息 // 个人未读消息
count = getUnreadCountByType(type, receiverId); count = getUnreadCountByType(type, receiverId);
} else { } else {
@@ -382,22 +382,28 @@ public class MessageCenterServiceImpl extends ServiceImpl<NotificationMapper, No
public void videoFinishedMsg(Long userId, String projectName, boolean isSuccess) { public void videoFinishedMsg(Long userId, String projectName, boolean isSuccess) {
Account account = accountService.getById(userId); Account account = accountService.getById(userId);
String language = account.getLanguage(); String language = account.getLanguage();
PublishSysNotificationDTO sysNotificationDTO = new PublishSysNotificationDTO();
Notification notification = new Notification(); Notification notification = new Notification();
notification.setType("system"); notification.setType("system");
notification.setReceiverId(userId); notification.setReceiverId(userId);
if (isSuccess) { if (isSuccess) {
if (language.equals(Language.ENGLISH.name())) { if (language.equals(Language.ENGLISH.name())) {
notification.setContent("Your video generation task in Project " + projectName + " is ready!"); sysNotificationDTO.setTitle("System Notification");
sysNotificationDTO.setContent("Your video generation task in Project " + projectName + " is ready!");
} else { } else {
notification.setContent("您在项目 " + projectName + " 中创建的视频生成任务已完成!"); sysNotificationDTO.setTitle("系统通知");
sysNotificationDTO.setContent("您在项目 " + projectName + " 中创建的视频生成任务已完成!");
} }
} else { } else {
if (language.equals(Language.ENGLISH.name())) { if (language.equals(Language.ENGLISH.name())) {
notification.setContent("Your video generation task in Project " + projectName + " has failed."); sysNotificationDTO.setTitle("System Notification");
sysNotificationDTO.setContent("Your video generation task in Project " + projectName + " has failed.");
} else { } else {
notification.setContent("视频生成任务失败。"); sysNotificationDTO.setTitle("系统通知");
sysNotificationDTO.setContent("视频生成任务失败。");
} }
} }
notification.setContent(JSON.toJSONString(sysNotificationDTO));
notification.setIsRead(0); notification.setIsRead(0);
notification.setCreateTime(LocalDateTime.now()); notification.setCreateTime(LocalDateTime.now());