TASK:用户账号到期邮件通知
This commit is contained in:
@@ -7,6 +7,7 @@ import com.ai.da.mapper.primary.entity.Account;
|
||||
import com.ai.da.mapper.primary.entity.SubscriptionInfo;
|
||||
import com.ai.da.service.StripeService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@@ -45,6 +46,11 @@ public class SubscriptionReminderTask {
|
||||
log.warn("未知的订阅类型: {}", subscriptionInfo.getType());
|
||||
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);
|
||||
if (success) {
|
||||
@@ -78,7 +84,7 @@ public class SubscriptionReminderTask {
|
||||
QueryWrapper<SubscriptionInfo> qw = new QueryWrapper<>();
|
||||
qw.ge("current_period_end", startTimestamp);
|
||||
qw.lt("current_period_end", endTimestamp);
|
||||
qw.eq("status", "active");
|
||||
// qw.eq("status", "active");
|
||||
qw.eq("subscription_type", subscriptionType);
|
||||
|
||||
return subscriptionInfoMapper.selectList(qw);
|
||||
|
||||
@@ -840,6 +840,18 @@ public class SendEmailUtil {
|
||||
templateUser.setTemplateID(156074L);
|
||||
}
|
||||
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":
|
||||
if (language.equals("ENGLISH")) {
|
||||
user.setSubject("[Code-Create] AiDA — Free Trial Ending");
|
||||
|
||||
Reference in New Issue
Block a user