Przeglądaj źródła

fix 奈飞账号登录失败不算异常

zoujiajian 1 rok temu
rodzic
commit
30110d9c60

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

@@ -1026,6 +1026,13 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 		if (renewalView.getGoodsId() != 1) {
 			throw BusinessRuntimeException.getInstance("只针对奈飞车票");
 		}
+		AccountNetflixState accountNetflixState = accountNetflixStateMapper.selectOne(Wrappers.lambdaQuery(AccountNetflixState.class)
+				.eq(AccountNetflixState::getAccount, renewalView.getAccount())
+				.orderByDesc(AccountNetflixState::getId)
+				.last("limit 1"));
+		if (accountNetflixState == null || accountNetflixState.getState() != 3) {
+			throw BusinessRuntimeException.getInstance("只支持异常账号更换车票");
+		}
 		Long groupId = renewalView.getGroupId();
 		Long skuId = renewalView.getSkuId();
 		Date expiryTime = renewalView.getExpiryTime();
@@ -1126,7 +1133,7 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 				.eq(AccountNetflixState::getAccount, account)
 				.last("limit 1"));
 		Integer state = 0;
-		if (accountNetflixState != null && (accountNetflixState.getState() == 2 || accountNetflixState.getState() == 3)) {
+		if (accountNetflixState != null && accountNetflixState.getState() == 3) {
 			state = accountNetflixState.getState();
 		}
 		NetflixUserAccountStatusRecord netflixUserAccountStatusRecord = new NetflixUserAccountStatusRecord();
@@ -1161,11 +1168,15 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 		}
 		Integer state = netflixUseAccountStatusRecord.getState();
 		//2是登录失败 3是被封号
-		if (state == 3 || state == 2) {
+		if (state == 3) {
 			if (netflixUseAccountStatusRecord.getCreatedTime().compareTo(DateUtil.offsetMinute(DateTime.now(), -10)) > 0) {
 				state = 0;
 			}
 		}
+		//登录失败不算异常
+		if (state == 2) {
+			state = 1;
+		}
 		return state;
 	}