付费用户邮件通知

This commit is contained in:
2024-07-09 17:28:38 +08:00
parent 64c7b8c1fd
commit 7cadab9345
4 changed files with 35 additions and 14 deletions

View File

@@ -23,6 +23,7 @@ public class AccountTask {
}
// todo 多久执行一次?
@Scheduled(cron = "0 */5 * * * *") // Run every 5 minutes
public void getPaidUser(){
// 获取code-create 表中 指定日期之后 订单状态为wc-processing的订单
accountService.extendValidityForCC();

View File

@@ -493,12 +493,12 @@ public class SendEmailUtil {
}
private final static Long NEW_USER_PAYMENT_NOTIFICATION_EN = 0L;
private final static Long NEW_USER_PAYMENT_NOTIFICATION_CN = 0L;
private final static Long RENEWAL_NOTIFICATION_FOR_OLD_USER_EN = 0L;
private final static Long RENEWAL_NOTIFICATION_FOR_OLD_USER_CN = 0L;
private final static Long NEW_USER_PAYMENT_NOTIFICATION_EN = 124889L;
private final static Long NEW_USER_PAYMENT_NOTIFICATION_CN = 124888L;
private final static Long RENEWAL_NOTIFICATION_FOR_OLD_USER_EN = 124892L;
private final static Long RENEWAL_NOTIFICATION_FOR_OLD_USER_CN = 124891L;
public static void notificationForPaidUser(String receiverAddress, int emailType, String country){
public static void notificationForPaidUser(String receiverAddress, int emailType, String country, String userName, String date){
try {
// 实例化一个认证对象
Credential cred = new Credential(SECRET_ID, SECRET_KEy);
@@ -514,6 +514,7 @@ public class SendEmailUtil {
// 根据邮件类型设置不同的主题和模板
String subject = "";
Template template = new Template();
JSONObject parameter = new JSONObject();
switch (emailType) {
// 新用户
case 1:
@@ -523,6 +524,8 @@ public class SendEmailUtil {
}else {
template.setTemplateID(NEW_USER_PAYMENT_NOTIFICATION_EN);
}
parameter.put("userName", userName);
parameter.put("email", receiverAddress);
break;
// 续费用户
case 2:
@@ -535,10 +538,12 @@ public class SendEmailUtil {
break;
default:
break;
// template.setTemplateData(buildNotificationData(trialOrder, link));
}
parameter.put("userName", userName);
parameter.put("date", date);
template.setTemplateData(parameter.toJSONString());
req.setSubject(subject);
req.setTemplate(template);