Jelajahi Sumber

fix 迪士尼登录一次性验证码

zoujiajian 2 tahun lalu
induk
melakukan
1c8a9f2f00

+ 23 - 15
netflix-common/src/main/java/com/cyksj/common/util/TicketCodeCommonUtil.java

@@ -20,25 +20,13 @@ public class TicketCodeCommonUtil {
 		if (StrUtil.isEmpty(body)) {
 			return body;
 		}
-		String str = null;
-		if (goodsId == 33l) {
-			str = "color:#505050; font-family:adobe-clean, Helvetica Neue, Helvetica, Verdana, Arial, sans-serif;";
-		}
-		if (goodsId == 3l) {
-			str = "letter-spacing:4px; line-height:38px; mso-line-height-rule: exactly";
-		}
+		String str = getCodeStartStr(goodsId, body);
 		if (StrUtil.isEmpty(str)) {
-			return str;
+			return null;
 		}
 		int index = body.indexOf(str);
 		if (index == -1) {
-			if (goodsId == 33l) {
-				str = "X-Report-Abuse: abuse@adobe.com";
-			}
-			if (goodsId == 3l) {
-				str = "Noto Sans Display', Helvetica, Arial, sans-serif; font-weight: 600;text-align: center;";
-			}
-			index = body.indexOf(str);
+			return null;
 		}
 		String code = StrUtil.subWithLength(body, index, 512);
 		if (StrUtil.isNotBlank(code)) {
@@ -61,4 +49,24 @@ public class TicketCodeCommonUtil {
 		}
 		return null;
 	}
+
+	public static String getCodeStartStr(Long goodsId, String body) {
+		String str = null;
+		if (goodsId == 33l) {
+			str = "color:#505050; font-family:adobe-clean, Helvetica Neue, Helvetica, Verdana, Arial, sans-serif;";
+			if (!body.contains(str)) {
+				str = "X-Report-Abuse: abuse@adobe.com";
+			}
+		}
+		if (goodsId == 3l) {
+			str = "letter-spacing:4px; line-height:38px; mso-line-height-rule: exactly";
+			if (!body.contains(str)) {
+				str = "Noto Sans Display', Helvetica, Arial, sans-serif; font-weight: 600;text-align: center;";
+				if (!body.contains(str)) {
+					str = "使用此密码验证 MyDisney 帐户关联的电子邮件地址。此密码将在 15 分钟后过期";
+				}
+			}
+		}
+		return str;
+	}
 }