소스 검색

fix 链接类型

zoujiajian 2 년 전
부모
커밋
9e05e17459

+ 5 - 0
netflix-dao/src/main/java/com/cyksj/model/request/TicketLoginReq.java

@@ -42,4 +42,9 @@ public class TicketLoginReq {
 	private Boolean sync;
 
 	private Long userId;
+
+	/**
+	 * 1.同步装置 ,2.验证链接
+	 */
+	private Integer linkType;
 }

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

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

+ 12 - 9
netflix-service/src/main/java/com/cyksj/service/mail/impl/CuiQiuMailServiceImpl.java

@@ -53,7 +53,7 @@ public class CuiQiuMailServiceImpl implements CuiQiuMailService {
 	private final static String NETFLIX = "Netflix";
 
 	@Override
-	public String getVerifyCode(String email, Long goodsId, Integer type, Boolean sync) throws Exception {
+	public String getVerifyCode(String email, Long goodsId, Integer type, Boolean sync, Integer linkType) throws Exception {
 		//获取近二十封邮件
 		String url = "https://domain-open-api.cuiqiu.com/v1/message/list";
 
@@ -101,7 +101,7 @@ public class CuiQiuMailServiceImpl implements CuiQiuMailService {
 			for (CuiQiuEmailDto cuiQiuEmailDto : list) {
 				Long messageId = cuiQiuEmailDto.getId();
 				try {
-					String code = getVerifyCodeByEmail(messageId, goodsId, type, sync);
+					String code = getVerifyCodeByEmail(messageId, goodsId, type, sync, linkType);
 					if (StrUtil.isNotBlank(code)) {
 						return code;
 					}
@@ -112,7 +112,7 @@ public class CuiQiuMailServiceImpl implements CuiQiuMailService {
 		return null;
 	}
 
-	public String getVerifyCodeByEmail(Long messageId, Long goodsId, Integer type, Boolean sync) throws Exception {
+	public String getVerifyCodeByEmail(Long messageId, Long goodsId, Integer type, Boolean sync, Integer linkType) 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);
@@ -136,14 +136,17 @@ public class CuiQiuMailServiceImpl implements CuiQiuMailService {
 					throw BusinessRuntimeException.getInstance("查询失败,请检查是否发送了登陆码..");
 				}
 			} else {
-				String urlPref = "https://www.netflix.com/account/update-primary-location";
-				String nfVerifyUrl = TicketCodeCommonUtil.extractUrl(body, urlPref);
-				if (StrUtil.isEmpty(nfVerifyUrl)) {
+				String urlPref;
+				String nfVerifyUrl;
+				if (linkType == 1) {
+					urlPref = "https://www.netflix.com/account/update-primary-location";
+					nfVerifyUrl = TicketCodeCommonUtil.extractUrl(body, urlPref);
+				} else {
 					urlPref = "https://www.netflix.com/account/travel/verify";
 					nfVerifyUrl = TicketCodeCommonUtil.extractUrl(body, urlPref);
-					if (StrUtil.isEmpty(nfVerifyUrl)) {
-						throw BusinessRuntimeException.getInstance("获取认证链接失败,请重新获取");
-					}
+				}
+				if (StrUtil.isEmpty(nfVerifyUrl)) {
+					throw BusinessRuntimeException.getInstance("获取认证链接失败,请重新获取");
 				}
 				//非点击装置同步更新按钮 直接返回链接
 				if (!sync) return nfVerifyUrl;

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

@@ -536,7 +536,7 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 			throw BusinessRuntimeException.getInstance("您的车票账号密码异常,请联系客服...");
 		}
 		if (renewalView.getAccount().contains(CUI_QIU_EMAIL_SUFFIX)) {
-			return cuiQiuMailService.getVerifyCode(renewalView.getAccount(), renewalView.getGoodsId(), type, sync);
+			return cuiQiuMailService.getVerifyCode(renewalView.getAccount(), renewalView.getGoodsId(), type, sync, loginReq.getLinkType());
 		}
 		//获取邮箱密码
 		SysEmail sysEmail = sysEmailMapper.selectOne(Wrappers.lambdaQuery(SysEmail.class)
@@ -564,7 +564,7 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 		if (execute.getStatus() != HttpStatus.HTTP_OK) {
 			throw BusinessRuntimeException.getInstance("获取验证码异常,请联系客服...");
 		}
-		String code = getDifferentGoodsCode(renewalView.getGoodsId(), execute.body(), type, sync);
+		String code = getDifferentGoodsCode(renewalView.getGoodsId(), execute.body(), type, sync, loginReq.getLinkType());
 		GroupsRelationLoginCodeRecord record = new GroupsRelationLoginCodeRecord();
 		record.setUserId(userId);
 		record.setRelationId(relationId);
@@ -762,7 +762,7 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 		return expiryTickets;
 	}
 
-	public String getDifferentGoodsCode(Long goodsId, String body, Integer type, Boolean sync) {
+	public String getDifferentGoodsCode(Long goodsId, String body, Integer type, Boolean sync, Integer linkType) {
 		String code = null;
 		//奈飞
 		if (goodsId == 1) {
@@ -777,14 +777,18 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 					throw BusinessRuntimeException.getInstance("查询失败,请检查是否发送了登陆码..");
 				}
 			} else {
-				String urlPref = "https://www.netflix.com/account/update-primary-location";
-				code = StrUtil.subBetween(body, "[" + urlPref, "]");
-				if (StrUtil.isEmpty(code)) {
+				String urlPref;
+				//更新装置
+				if (linkType == 1) {
+					urlPref = "https://www.netflix.com/account/update-primary-location";
+					code = StrUtil.subBetween(body, "[" + urlPref, "]");
+				} else {
+					//验证链接
 					urlPref = "https://www.netflix.com/account/travel/verify";
 					code = StrUtil.subBetween(body, "[" + urlPref, "]");
-					if (StrUtil.isEmpty(code)) {
-						throw BusinessRuntimeException.getInstance("获取认证链接失败,请重新获取");
-					}
+				}
+				if (StrUtil.isEmpty(code)) {
+					throw BusinessRuntimeException.getInstance("获取认证链接失败,请重新获取");
 				}
 				String url = urlPref + code;
 				//非点击装置同步更新按钮 直接返回链接