Pārlūkot izejas kodu

兼容脆球迪士尼获取验证码

zoujiajian 2 gadi atpakaļ
vecāks
revīzija
aecfea7f09

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

@@ -11,5 +11,5 @@ public interface CuiQiuMailService {
 	/**
 	 * 获取最新邮箱 返回验证码
 	 */
-	String getVerifyCode(String email) throws Exception;
+	String getVerifyCode(String email, Long goodsId) throws Exception;
 }

+ 21 - 6
netflix-service/src/main/java/com/cyksj/service/mail/impl/CuiQiuMailServiceImpl.java

@@ -41,8 +41,10 @@ public class CuiQiuMailServiceImpl implements CuiQiuMailService {
 	//PS 验证码官方
 	private final static String PS_ADOBE = "Adobe";
 
+	private final static String DISNEY = "Disney+";
+
 	@Override
-	public String getVerifyCode(String email) throws Exception {
+	public String getVerifyCode(String email, Long goodsId) throws Exception {
 		//获取近二十封邮件
 		String url = "https://domain-open-api.cuiqiu.com/v1/message/list";
 
@@ -67,8 +69,15 @@ public class CuiQiuMailServiceImpl implements CuiQiuMailService {
 		list = list.stream().filter(emailInfo -> {
 			CuiQiuEmailDto.CuiQiuUser from = emailInfo.getFrom().get(0);
 			CuiQiuEmailDto.CuiQiuUser cuiQiuUser = emailInfo.getTo().get(0);
-			if (StrUtil.equals(from.getName(), PS_ADOBE) && StrUtil.equals(cuiQiuUser.getAddress(), email)) {
-				return true;
+			if (StrUtil.equalsIgnoreCase(cuiQiuUser.getAddress(), email)) {
+				//PS
+				if (goodsId == 33l && StrUtil.equals(from.getName(), PS_ADOBE)) {
+					return true;
+				}
+				//Disney
+				if (goodsId == 3l && StrUtil.equals(from.getName(), DISNEY)) {
+					return true;
+				}
 			}
 			return false;
 		}).collect(Collectors.toList());
@@ -77,7 +86,7 @@ public class CuiQiuMailServiceImpl implements CuiQiuMailService {
 			for (CuiQiuEmailDto cuiQiuEmailDto : list) {
 				Long messageId = cuiQiuEmailDto.getId();
 				try {
-					String code = getVerifyCodeByEmail(messageId);
+					String code = getVerifyCodeByEmail(messageId, goodsId);
 					if (StrUtil.isNotBlank(code)) {
 						return code;
 					}
@@ -88,7 +97,7 @@ public class CuiQiuMailServiceImpl implements CuiQiuMailService {
 		return null;
 	}
 
-	public String getVerifyCodeByEmail(Long messageId) throws Exception {
+	public String getVerifyCodeByEmail(Long messageId, Long goodsId) throws Exception {
 		String url = "https://domain-open-api.cuiqiu.com/v1/message/detail";
 		Map<String, Object> params = new HashMap<>();
 		params.put("token", CUI_QIU_TOKEN);
@@ -102,7 +111,13 @@ public class CuiQiuMailServiceImpl implements CuiQiuMailService {
 		CuiQiuEmailDetailDto.Content content = cuiQiuEmailDetailDto.getData().getContent();
 
 		String contentBody = content.getBody();
-		String str = "color:#505050; font-family:adobe-clean, Helvetica Neue, Helvetica, Verdana, Arial, sans-serif;";
+		String str = null;
+		if (goodsId == 33l) {
+			str = "color:#505050; font-family:adobe-clean, Helvetica Neue, Helvetica, Verdana, Arial, sans-serif;";
+		}
+		if (goodsId == 3l) {
+			str = "'Noto Sans Display', Arial, sans-serif; letter-spacing:4px;";
+		}
 		String code = StrUtil.subWithLength(contentBody, contentBody.indexOf(str), 512);
 		if (StrUtil.isNotBlank(code)) {
 			code = code.replace(str, "");

+ 2 - 2
netflix-service/src/main/java/com/cyksj/service/relation/impl/GroupRelationFrontServiceImpl.java

@@ -465,8 +465,8 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 		if (StrUtil.hasEmpty(account, password)) {
 			throw BusinessRuntimeException.getInstance("您的车票账号密码异常,请联系客服...");
 		}
-		if (renewalView.getGoodsId() == 33l && renewalView.getAccount().contains(CUI_QIU_EMAIL_SUFFIX)) {
-			return cuiQiuMailService.getVerifyCode(renewalView.getAccount());
+		if (renewalView.getAccount().contains(CUI_QIU_EMAIL_SUFFIX)) {
+			return cuiQiuMailService.getVerifyCode(renewalView.getAccount(), renewalView.getGoodsId());
 		}
 		//获取邮箱密码
 		SysEmail sysEmail = sysEmailMapper.selectOne(Wrappers.lambdaQuery(SysEmail.class)