Merge remote-tracking branch 'origin/dev/3.1_release_merge' into dev/3.1_release_merge

This commit is contained in:
litianxiang
2025-11-26 16:14:09 +08:00
4 changed files with 30 additions and 6 deletions

View File

@@ -7,6 +7,7 @@ import com.ai.da.mapper.primary.entity.Account;
import com.ai.da.mapper.primary.entity.SubscriptionInfo; import com.ai.da.mapper.primary.entity.SubscriptionInfo;
import com.ai.da.service.StripeService; import com.ai.da.service.StripeService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.netty.util.internal.StringUtil;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@@ -45,6 +46,11 @@ public class SubscriptionReminderTask {
log.warn("未知的订阅类型: {}", subscriptionInfo.getType()); log.warn("未知的订阅类型: {}", subscriptionInfo.getType());
continue; continue;
} }
String emailType = subscriptionInfo.getStatus().equals("active") ? "reminder_subscriber" : subscriptionInfo.getStatus().equals("canceled") ? "reminder_expire" : null;
if (StringUtil.isNullOrEmpty(emailType)) {
log.warn("未知订阅状态:{}", subscriptionInfo.getStatus());
continue;
}
boolean success = stripeService.sendEmail(subscriptionInfo.getSubscriptionId(), "reminder_subscriber", null); boolean success = stripeService.sendEmail(subscriptionInfo.getSubscriptionId(), "reminder_subscriber", null);
if (success) { if (success) {
@@ -78,7 +84,7 @@ public class SubscriptionReminderTask {
QueryWrapper<SubscriptionInfo> qw = new QueryWrapper<>(); QueryWrapper<SubscriptionInfo> qw = new QueryWrapper<>();
qw.ge("current_period_end", startTimestamp); qw.ge("current_period_end", startTimestamp);
qw.lt("current_period_end", endTimestamp); qw.lt("current_period_end", endTimestamp);
qw.eq("status", "active"); // qw.eq("status", "active");
qw.eq("subscription_type", subscriptionType); qw.eq("subscription_type", subscriptionType);
return subscriptionInfoMapper.selectList(qw); return subscriptionInfoMapper.selectList(qw);

View File

@@ -840,6 +840,18 @@ public class SendEmailUtil {
templateUser.setTemplateID(156074L); templateUser.setTemplateID(156074L);
} }
break; break;
case "reminder_expire":
if (language.equals("ENGLISH")) {
user.setSubject("[Code-Create] AiDA account is about to expire");
templateUser.setTemplateID(156749L);
} else if (language.equals("CHINESE")){
user.setSubject("[Code-Create] 您的AiDA账号即将到期");
templateUser.setTemplateID(156750L);
} else {
user.setSubject("[Code-Create] 您的AiDA帳號即將到期");
templateUser.setTemplateID(156751L);
}
break;
case "reminder_trial": case "reminder_trial":
if (language.equals("ENGLISH")) { if (language.equals("ENGLISH")) {
user.setSubject("[Code-Create] AiDA — Free Trial Ending"); user.setSubject("[Code-Create] AiDA — Free Trial Ending");

View File

@@ -60,7 +60,7 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor @RequiredArgsConstructor
public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementMapper, CollectionElement> implements CollectionElementService { public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementMapper, CollectionElement> implements CollectionElementService {
private final CollectionElementMapper collectionElementMapper; private final CollectionElementMapper collectionElementMapper;
private final EmailService emailService; // private final EmailService emailService;
private final FileProperties fileProperties; private final FileProperties fileProperties;
private final GenerateMapper generateMapper; private final GenerateMapper generateMapper;
private final GenerateDetailMapper generateDetailMapper; private final GenerateDetailMapper generateDetailMapper;

View File

@@ -402,21 +402,27 @@ public class MessageCenterServiceImpl extends ServiceImpl<NotificationMapper, No
notification.setType("system"); notification.setType("system");
notification.setReceiverId(userId); notification.setReceiverId(userId);
if (isSuccess) { if (isSuccess) {
if (language.equals(Language.ENGLISH.name())) { sysNotificationDTO.setTitle("System Notification 系统通知");
sysNotificationDTO.setContent("Your video generation task in Project " + projectName + " is ready!\n"
+ "您在项目 " + projectName + " 中创建的视频生成任务已完成!");
/*if (language.equals(Language.ENGLISH.name())) {
sysNotificationDTO.setTitle("System Notification"); sysNotificationDTO.setTitle("System Notification");
sysNotificationDTO.setContent("Your video generation task in Project " + projectName + " is ready!"); sysNotificationDTO.setContent("Your video generation task in Project " + projectName + " is ready!");
} else { } else {
sysNotificationDTO.setTitle("系统通知"); sysNotificationDTO.setTitle("系统通知");
sysNotificationDTO.setContent("您在项目 " + projectName + " 中创建的视频生成任务已完成!"); sysNotificationDTO.setContent("您在项目 " + projectName + " 中创建的视频生成任务已完成!");
} }*/
} else { } else {
if (language.equals(Language.ENGLISH.name())) { sysNotificationDTO.setTitle("System Notification 系统通知");
sysNotificationDTO.setContent("Your video generation task in Project " + projectName + " has failed.\n"
+ "您在项目 " + projectName + " 中创建的视频生成任务失败。");
/*if (language.equals(Language.ENGLISH.name())) {
sysNotificationDTO.setTitle("System Notification"); sysNotificationDTO.setTitle("System Notification");
sysNotificationDTO.setContent("Your video generation task in Project " + projectName + " has failed."); sysNotificationDTO.setContent("Your video generation task in Project " + projectName + " has failed.");
} else { } else {
sysNotificationDTO.setTitle("系统通知"); sysNotificationDTO.setTitle("系统通知");
sysNotificationDTO.setContent("视频生成任务失败。"); sysNotificationDTO.setContent("视频生成任务失败。");
} }*/
} }
notification.setContent(JSON.toJSONString(sysNotificationDTO)); notification.setContent(JSON.toJSONString(sysNotificationDTO));
notification.setIsRead(0); notification.setIsRead(0);