소스 검색

fix 关联邮箱

zoujiajian 1 년 전
부모
커밋
f694891169

+ 1 - 1
netflix-service/src/main/java/com/cyksj/service/mail/MailLuService.java

@@ -9,5 +9,5 @@ package com.cyksj.service.mail;
 public interface MailLuService {
 	boolean isMailLuEmail(String account);
 
-	String getVerifyCode(String account, Long goodsId, Integer type, Integer linkType, boolean isReturnDeviceUrl) throws Exception;
+	String getVerifyCode(String account, String relateEmail, Long goodsId, Integer type, Integer linkType, boolean isReturnDeviceUrl) throws Exception;
 }

+ 1 - 1
netflix-service/src/main/java/com/cyksj/service/mail/YhMailService.java

@@ -11,7 +11,7 @@ public interface YhMailService {
 	/**
 	 * 获取最新邮箱 返回验证码
 	 */
-	String getVerifyCode(String email, Long goodsId, Integer type, Integer linkType, Boolean isReturnDeviceUrl) throws Exception;
+	String getVerifyCode(String email, String relateEmail, Long goodsId, Integer type, Integer linkType, Boolean isReturnDeviceUrl) throws Exception;
 
 	String readResetPwdResetLink(String account);
 

+ 5 - 7
netflix-service/src/main/java/com/cyksj/service/mail/impl/CommonMailServiceImpl.java

@@ -55,18 +55,16 @@ public class CommonMailServiceImpl implements CommonMailService {
 			} catch (Exception e) {
 			}
 		}
+		String checkEmail = StrUtil.isNotEmpty(relateEmail) ? relateEmail : account;
 		//关联邮箱
-		if (StrUtil.isNotEmpty(relateEmail)) {
-			account = relateEmail;
-		}
-		if (cuiQiuMailService.isCuiQiuEmail(account)) {
+		if (cuiQiuMailService.isCuiQiuEmail(checkEmail)) {
 			return cuiQiuMailService.getVerifyCode(account, relateEmail, goodsId, type, linkType, false);
 		}
 		//是否是 mail lu邮箱
-		if (mailLuService.isMailLuEmail(account)) {
-			return mailLuService.getVerifyCode(account, goodsId, type, linkType, false);
+		if (mailLuService.isMailLuEmail(checkEmail)) {
+			return mailLuService.getVerifyCode(account, relateEmail, goodsId, type, linkType, false);
 		}
 		//银河域名邮件
-		return yhMailService.getVerifyCode(account, goodsId, type, linkType, false);
+		return yhMailService.getVerifyCode(account, relateEmail, goodsId, type, linkType, false);
 	}
 }

+ 2 - 2
netflix-service/src/main/java/com/cyksj/service/mail/impl/MailLuServiceImpl.java

@@ -48,7 +48,7 @@ public class MailLuServiceImpl implements MailLuService {
 	}
 
 	@Override
-	public String getVerifyCode(String account, Long goodsId, Integer type, Integer linkType, boolean isReturnDeviceUrl) throws Exception{
+	public String getVerifyCode(String account, String relateEmail, Long goodsId, Integer type, Integer linkType, boolean isReturnDeviceUrl) throws Exception {
 		Properties props = new Properties();
 		props.put("mail.imap.host", "mail.yxzh8.com"); // 替换为你的IMAP服务器
 		props.put("mail.imap.port", "993"); // IMAP服务的端口号,通常是993
@@ -56,7 +56,7 @@ public class MailLuServiceImpl implements MailLuService {
 
 		Session session = Session.getInstance(props, new javax.mail.Authenticator() {
 			protected PasswordAuthentication getPasswordAuthentication() {
-				return new PasswordAuthentication(account, UNIFIED_PWD);
+				return new PasswordAuthentication(StrUtil.isNotBlank(relateEmail) ? relateEmail : account, UNIFIED_PWD);
 			}
 		});
 

+ 2 - 2
netflix-service/src/main/java/com/cyksj/service/mail/impl/YhEmailServiceImpl.java

@@ -35,8 +35,8 @@ public class YhEmailServiceImpl implements YhMailService {
 	private final SysEmailMapper sysEmailMapper;
 
 	@Override
-	public String getVerifyCode(String account, Long goodsId, Integer type, Integer linkType, Boolean isReturnDeviceUrl) throws Exception {
-		String body = readEmail(account);
+	public String getVerifyCode(String account, String relateEmail, Long goodsId, Integer type, Integer linkType, Boolean isReturnDeviceUrl) throws Exception {
+		String body = readEmail(StrUtil.isNotEmpty(relateEmail) ? relateEmail : account);
 		String code = getDifferentGoodsCode(goodsId, body, type, linkType, isReturnDeviceUrl);
 		if (StrUtil.isEmpty(code)) {
 			throw BusinessRuntimeException.getInstance("请重新发送对应邮件");