|
|
@@ -28,6 +28,7 @@ import com.cyksj.mapper.manage.distribute.UserPlatSkuDistributeRateMapper;
|
|
|
import com.cyksj.mapper.sys.SysEmailMapper;
|
|
|
import com.cyksj.model.entity.*;
|
|
|
import com.cyksj.model.request.SpecialGoodsTicketReq;
|
|
|
+import com.cyksj.model.request.TicketLoginReq;
|
|
|
import com.cyksj.model.views.*;
|
|
|
import com.cyksj.redis.RedisService;
|
|
|
import com.cyksj.service.chatgpt.ChatGptAccountService;
|
|
|
@@ -515,7 +516,11 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public String getAiVerifyCode(Long userId, Long relationId, Integer type, Boolean sync) throws Exception {
|
|
|
+ public String getAiVerifyCode(TicketLoginReq loginReq) throws Exception {
|
|
|
+ Long userId = loginReq.getUserId();
|
|
|
+ Long relationId = loginReq.getRelationId();
|
|
|
+ Integer type = loginReq.getType();
|
|
|
+ Boolean sync = loginReq.getSync();
|
|
|
List<Long> relationUserIdList = userBindRelationService.getRelationUserIdList(userId, null);
|
|
|
RenewalView renewalView = beanSearcher.searchFirst(RenewalView.class, MapUtils.builder().field(RenewalView::getUserId, relationUserIdList).op(Operator.InList)
|
|
|
.field(RenewalView::getRelationId, relationId).build());
|
|
|
@@ -531,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)
|
|
|
@@ -559,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);
|
|
|
@@ -757,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) {
|
|
|
@@ -772,18 +777,22 @@ 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;
|
|
|
//非点击装置同步更新按钮 直接返回链接
|
|
|
- if (!sync) return url;
|
|
|
+ if (linkType == 2) return url;
|
|
|
//失败返回验证链接
|
|
|
if (!groupsRelationNetflixService.confirmUpdate(url)) {
|
|
|
return url;
|
|
|
@@ -876,6 +885,50 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
return renewalView;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public GroupsRelation ticketLogin(TicketLoginReq loginReq) {
|
|
|
+ String account = loginReq.getAccount();
|
|
|
+ String password = loginReq.getPassword();
|
|
|
+ Integer num = loginReq.getNum();
|
|
|
+ Long goodsId = Optional.ofNullable(loginReq.getGoodsId()).orElse(1l);
|
|
|
+ GroupsRelation relation = groupsRelationMapper.selectRelationByAccountAndNum(account, password, goodsId, num);
|
|
|
+ if (relation == null) {
|
|
|
+ log.info("外部入口使用账号account:{},pwd:{},座位num:{}登录失败...", account, password, num);
|
|
|
+ if (StrUtil.equals(loginReq.getLang(), Constant.EN_US)) {
|
|
|
+ throw BusinessRuntimeException.getInstance("Please enter the correct account information");
|
|
|
+ }
|
|
|
+ throw BusinessRuntimeException.getInstance("请输入正确的账号信息");
|
|
|
+ }
|
|
|
+ return relation;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String outsideTicketVerify(TicketLoginReq loginReq) {
|
|
|
+ String account = loginReq.getAccount();
|
|
|
+ String password = loginReq.getPassword();
|
|
|
+ Integer num = loginReq.getNum();
|
|
|
+ Long goodsId = Optional.ofNullable(loginReq.getGoodsId()).orElse(1l);
|
|
|
+ GroupsRelation relation = groupsRelationMapper.selectRelationByAccountAndNum(account, password, goodsId, num);
|
|
|
+ if (relation == null) {
|
|
|
+ log.info("外部入口使用账号account:{},pwd:{},座位num:{}同步验证链接失败...", account, password, num);
|
|
|
+ if (StrUtil.equals(loginReq.getLang(), Constant.EN_US)) {
|
|
|
+ throw BusinessRuntimeException.getInstance("This account is no longer valid");
|
|
|
+ }
|
|
|
+ throw BusinessRuntimeException.getInstance("该账号已失效");
|
|
|
+ }
|
|
|
+ loginReq.setUserId(relation.getUserId());
|
|
|
+ loginReq.setRelationId(relation.getId());
|
|
|
+ loginReq.setGoodsId(goodsId);
|
|
|
+ try {
|
|
|
+ return getAiVerifyCode(loginReq);
|
|
|
+ } catch (Exception e) {
|
|
|
+ if (StrUtil.equals(loginReq.getLang(), Constant.EN_US)) {
|
|
|
+ throw BusinessRuntimeException.getInstance("Please verify that the link was sent");
|
|
|
+ }
|
|
|
+ throw BusinessRuntimeException.getInstance("请校验链接是否已发送");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private DistributePosterGoodsDetailView setGoodsPoster(RenewalView ticket, User user) {
|
|
|
DistributePosterGoodsDetailView distributePosterGoodsDetailView = beanSearcher.searchFirst(DistributePosterGoodsDetailView.class, MapUtils.flatBuilder(request.getParameterMap())
|
|
|
.field(DistributePosterGoodsFrontView::getGoodsId, ticket.getGoodsId()).build());
|