TASK: 试用用户添加测试;

This commit is contained in:
shahaibo
2023-12-11 14:35:05 +08:00
parent 2b8f970acc
commit 7fdacaeb7c
3 changed files with 6 additions and 7 deletions

View File

@@ -128,7 +128,7 @@ public class SendEmailUtil {
private final static Long YOUR_TRIAL_TEMPLATE_ID = 117214L;
private final static Long APPROVAL_TEMPLATE_ID = 117215L;
private final static Long NOTIFICATION_TEMPLATE_ID = 117216L;
public static Boolean sendCustomEmail(String receiverAddress, String senderAddress, TrialOrder trialOrder, int emailType) {
public static void sendCustomEmail(String receiverAddress, String senderAddress, TrialOrder trialOrder, int emailType) {
try {
// 实例化一个认证对象
Credential cred = new Credential(SECRET_ID, SECRET_KEy);
@@ -173,7 +173,6 @@ public class SendEmailUtil {
// 发送邮件
SendEmailResponse resp = client.SendEmail(req);
log.info("短信发送结果res###{}", SendEmailResponse.toJsonString(resp));
return Boolean.TRUE;
} catch (TencentCloudSDKException e) {
log.info("邮件发送失败###{}", e.toString());
throw new BusinessException("failed.to.send.mail");

View File

@@ -2,7 +2,7 @@ package com.ai.da.model.enums;
public class AutoApproved {
// 静态变量,整个应用程序共享
private static boolean status = false;
private static boolean status = true;
// 获取当前状态
public static boolean getStatus() {

View File

@@ -477,6 +477,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
trialOrder.setCreateTime(LocalDateTime.now());
trialOrder.setStatus(0);
trialOrderMapper.insert(trialOrder);
SendEmailUtil.sendCustomEmail("1023316923@qq.com", null, trialOrder,1);
// 判断当前的试用订单是否自动批准
if (AutoApproved.getStatus()) {
// 改变试用订单状态,新增试用用户
@@ -487,7 +488,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
account.setUserName(trialOrder.getUserName());
account.setUserPassword("Third-000000");
account.setUserEmail(trialOrder.getEmail());
account.setLanguage(Language.ENGLISH.getValue());
account.setLanguage(Language.ENGLISH.name());
account.setValidStartTime(System.currentTimeMillis());
account.setValidEndTime(Instant.now().plus(3, ChronoUnit.DAYS).toEpochMilli());
account.setCreateDate(new Date());
@@ -495,9 +496,8 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
account.setIsBeginner(1);
accountMapper.insert(account);
// 发送邮件提醒用户试用用户已创建
// if (SendEmailUtil.sendCustomEmail("1023316923@qq.com", null, trialOrder,1)) {
// return Boolean.TRUE;
// }
SendEmailUtil.sendCustomEmail("1023316923@qq.com", null, trialOrder,2);
SendEmailUtil.sendCustomEmail(account.getUserEmail(), null, trialOrder, 3);
}
return Boolean.TRUE;
}