|
@@ -12,16 +12,16 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.cyksj.common.constant.Constant;
|
|
import com.cyksj.common.constant.Constant;
|
|
|
import com.cyksj.common.exception.BusinessRuntimeException;
|
|
import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
|
|
+import com.cyksj.common.i18n.I18nMessageUtil;
|
|
|
import com.cyksj.common.task.GlobalThreadPoolTaskExecutor;
|
|
import com.cyksj.common.task.GlobalThreadPoolTaskExecutor;
|
|
|
|
|
+import com.cyksj.common.util.Jsons;
|
|
|
import com.cyksj.common.util.StringUtil;
|
|
import com.cyksj.common.util.StringUtil;
|
|
|
import com.cyksj.common.util.TicketCodeCommonUtil;
|
|
import com.cyksj.common.util.TicketCodeCommonUtil;
|
|
|
import com.cyksj.enums.GatewayApiCode;
|
|
import com.cyksj.enums.GatewayApiCode;
|
|
|
-import com.cyksj.mapper.GroupsMapper;
|
|
|
|
|
-import com.cyksj.mapper.GroupsRelationLoginCodeRecordMapper;
|
|
|
|
|
-import com.cyksj.mapper.GroupsRelationMapper;
|
|
|
|
|
-import com.cyksj.mapper.UserMapper;
|
|
|
|
|
|
|
+import com.cyksj.mapper.*;
|
|
|
import com.cyksj.mapper.sys.SysEmailMapper;
|
|
import com.cyksj.mapper.sys.SysEmailMapper;
|
|
|
import com.cyksj.model.entity.*;
|
|
import com.cyksj.model.entity.*;
|
|
|
|
|
+import com.cyksj.model.request.TicketLoginReq;
|
|
|
import com.cyksj.model.views.*;
|
|
import com.cyksj.model.views.*;
|
|
|
import com.cyksj.redis.RedisService;
|
|
import com.cyksj.redis.RedisService;
|
|
|
import com.cyksj.service.chatgpt.ChatGptAuthService;
|
|
import com.cyksj.service.chatgpt.ChatGptAuthService;
|
|
@@ -31,18 +31,18 @@ import com.cyksj.service.mange.coupon.CouponCommonService;
|
|
|
import com.cyksj.service.relation.GroupRelationFrontService;
|
|
import com.cyksj.service.relation.GroupRelationFrontService;
|
|
|
import com.cyksj.service.relation.GroupsRelationNetflixService;
|
|
import com.cyksj.service.relation.GroupsRelationNetflixService;
|
|
|
import com.cyksj.service.user.UserBindRelationService;
|
|
import com.cyksj.service.user.UserBindRelationService;
|
|
|
|
|
+import com.cyksj.service.user.UserLoginRecordService;
|
|
|
import com.ejlchina.searcher.BeanSearcher;
|
|
import com.ejlchina.searcher.BeanSearcher;
|
|
|
|
|
+import com.ejlchina.searcher.SearchResult;
|
|
|
import com.ejlchina.searcher.param.Operator;
|
|
import com.ejlchina.searcher.param.Operator;
|
|
|
|
|
+import com.ejlchina.searcher.util.MapBuilder;
|
|
|
import com.ejlchina.searcher.util.MapUtils;
|
|
import com.ejlchina.searcher.util.MapUtils;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
|
|
-import java.util.HashMap;
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
-import java.util.Map;
|
|
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
|
|
|
import static com.cyksj.enums.GatewayApiCode.GROUP_INDEX_ALREADY_BE_USER;
|
|
import static com.cyksj.enums.GatewayApiCode.GROUP_INDEX_ALREADY_BE_USER;
|
|
|
import static com.cyksj.enums.GatewayApiCode.GROUP_INDEX_NOT_FIND;
|
|
import static com.cyksj.enums.GatewayApiCode.GROUP_INDEX_NOT_FIND;
|
|
@@ -83,34 +83,59 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
|
|
|
|
|
private final GroupsFuncService groupsFuncService;
|
|
private final GroupsFuncService groupsFuncService;
|
|
|
|
|
|
|
|
|
|
+ private final HttpServletRequest request;
|
|
|
|
|
+
|
|
|
|
|
+ private final UserFuncPropertyMapper userFuncPropertyMapper;
|
|
|
|
|
+
|
|
|
|
|
+ private final GoodsDonSkuMapper goodsDonSkuMapper;
|
|
|
|
|
+
|
|
|
|
|
+ private final OrderDonMapper orderDonMapper;
|
|
|
|
|
+
|
|
|
|
|
+ private final OrderDiscountPlusPurchaseSkuRelationMapper orderDiscountPlusPurchaseSkuRelationMapper;
|
|
|
|
|
+
|
|
|
|
|
+ private final UserLoginRecordService userLoginRecordService;
|
|
|
|
|
+
|
|
|
private static final GlobalThreadPoolTaskExecutor TASK_EXECUTOR = GlobalThreadPoolTaskExecutor.getInstance();
|
|
private static final GlobalThreadPoolTaskExecutor TASK_EXECUTOR = GlobalThreadPoolTaskExecutor.getInstance();
|
|
|
|
|
|
|
|
//脆球邮箱后缀
|
|
//脆球邮箱后缀
|
|
|
private final static String CUI_QIU_EMAIL_SUFFIX = "@kindvd.com";
|
|
private final static String CUI_QIU_EMAIL_SUFFIX = "@kindvd.com";
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public List<RenewalView> getMyTicket(long userId, Boolean isLoginPopularize) {
|
|
|
|
|
|
|
+ public SearchResult<RenewalView> getMyTicket(long userId, Boolean isLoginPopularize, String account) {
|
|
|
User u = userMapper.selectById(userId);
|
|
User u = userMapper.selectById(userId);
|
|
|
if (u == null) throw BusinessRuntimeException.getGatewayApiCode(GatewayApiCode.CMS_TOKEN_VALID);
|
|
if (u == null) throw BusinessRuntimeException.getGatewayApiCode(GatewayApiCode.CMS_TOKEN_VALID);
|
|
|
if (u.getIsBlack()) {
|
|
if (u.getIsBlack()) {
|
|
|
- return new ArrayList<>();
|
|
|
|
|
|
|
+ return new SearchResult<>();
|
|
|
}
|
|
}
|
|
|
List<Long> userIds = userBindRelationService.getRelationUserIdList(userId, u);
|
|
List<Long> userIds = userBindRelationService.getRelationUserIdList(userId, u);
|
|
|
- List<RenewalView> list = beanSearcher.searchAll(RenewalView.class, MapUtils.builder()
|
|
|
|
|
|
|
+ MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
|
|
|
|
|
+ //Long yhsId = yhShopFrontService.getYhsIdByCustomId(customId);
|
|
|
|
|
+ DateTime now = DateTime.now();
|
|
|
|
|
+ if (StrUtil.isNotBlank(account)) {
|
|
|
|
|
+ builder.field(RenewalView::getAccount, account).op(Operator.Contain);
|
|
|
|
|
+ }
|
|
|
|
|
+ SearchResult<RenewalView> list = beanSearcher.search(RenewalView.class, builder
|
|
|
.field(RenewalView::getUserId, 0).op(Operator.GreaterThan)
|
|
.field(RenewalView::getUserId, 0).op(Operator.GreaterThan)
|
|
|
.field(RenewalView::getUserId, userIds).op(Operator.InList)
|
|
.field(RenewalView::getUserId, userIds).op(Operator.InList)
|
|
|
|
|
+ //.field(RenewalView::getYhsId, yhsId)
|
|
|
|
|
+ .put("condition", String.format("(gr.expiry_time is null or gr.expiry_time > '%s')", now))
|
|
|
.field(RenewalView::getStatus, List.of("validity", "overdue", "outside")).op(Operator.InList)
|
|
.field(RenewalView::getStatus, List.of("validity", "overdue", "outside")).op(Operator.InList)
|
|
|
.orderBy(RenewalView::getExpiryTime).asc()
|
|
.orderBy(RenewalView::getExpiryTime).asc()
|
|
|
.build());
|
|
.build());
|
|
|
//过滤邀请制、已失效的车位
|
|
//过滤邀请制、已失效的车位
|
|
|
- DateTime now = DateTime.now();
|
|
|
|
|
- List<RenewalView> collect = list.stream().filter(ticket -> {
|
|
|
|
|
- if (ticket.getExpiryTime() != null && ticket.getExpiryTime().before(now)) {
|
|
|
|
|
- return false;
|
|
|
|
|
|
|
+ Integer size = list.getTotalCount().intValue();
|
|
|
|
|
+
|
|
|
|
|
+ list.getDataList().forEach(ticket -> {
|
|
|
|
|
+ if (ticket.getSkuId() == null || ticket.getGoodsId() == null) {
|
|
|
|
|
+ return;
|
|
|
}
|
|
}
|
|
|
if (ticket.getGoodsId() == 18 && ticket.getSkuNum() > 1) {
|
|
if (ticket.getGoodsId() == 18 && ticket.getSkuNum() > 1) {
|
|
|
ticket.setPassword(null);
|
|
ticket.setPassword(null);
|
|
|
}
|
|
}
|
|
|
|
|
+ ticket.setIsMulti(false);
|
|
|
|
|
+ if (ticket.getSkuNum() > 1) {
|
|
|
|
|
+ ticket.setIsMulti(true);
|
|
|
|
|
+ }
|
|
|
//chatGPT直连
|
|
//chatGPT直连
|
|
|
if (ticket.getGoodsId().equals(42l)) {
|
|
if (ticket.getGoodsId().equals(42l)) {
|
|
|
if (StrUtil.isNotBlank(ticket.getAccount())) {
|
|
if (StrUtil.isNotBlank(ticket.getAccount())) {
|
|
@@ -143,18 +168,69 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
if (ticket.getExpiryTime() != null && ticket.getGoodsType() == 1 && ticket.getSecondType() == 2) {
|
|
if (ticket.getExpiryTime() != null && ticket.getGoodsType() == 1 && ticket.getSecondType() == 2) {
|
|
|
String remainDays = DateUtil.formatBetween(now, ticket.getExpiryTime(), BetweenFormater.Level.DAY);
|
|
String remainDays = DateUtil.formatBetween(now, ticket.getExpiryTime(), BetweenFormater.Level.DAY);
|
|
|
if ("0天".equals(remainDays)) {
|
|
if ("0天".equals(remainDays)) {
|
|
|
- remainDays = "小于1天";
|
|
|
|
|
|
|
+ remainDays = I18nMessageUtil.getI18nMsg("less_than_one_day");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ //当天也算
|
|
|
|
|
+ int days = Integer.parseInt(remainDays.substring(0, remainDays.indexOf("天")));
|
|
|
|
|
+ remainDays = days + 1 + I18nMessageUtil.getI18nMsg("days");
|
|
|
}
|
|
}
|
|
|
ticket.setRemainDays(remainDays);
|
|
ticket.setRemainDays(remainDays);
|
|
|
}
|
|
}
|
|
|
|
|
+ OrderDon orderDon = orderDonMapper.selectOne(Wrappers.lambdaQuery(OrderDon.class)
|
|
|
|
|
+ .eq(OrderDon::getRelationId, ticket.getRelationId())
|
|
|
|
|
+ .eq(OrderDon::getUserId, ticket.getUserId())
|
|
|
|
|
+ .notIn(OrderDon::getStatus, Constant.noOrderAllStatus)
|
|
|
|
|
+ .orderByDesc(OrderDon::getId)
|
|
|
|
|
+ .last("limit 1"));
|
|
|
|
|
+ if (orderDon != null) {
|
|
|
|
|
+ ticket.setOrderNo(orderDon.getOrderNo());
|
|
|
|
|
+ ticket.setOrderId(orderDon.getId());
|
|
|
|
|
+ ticket.setTransactionId(orderDon.getTransactionId());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (size > 1 && ticket.getGoodsId() != 18) {
|
|
|
|
|
+ Date payTime = null;
|
|
|
|
|
+ if (orderDon != null) {
|
|
|
|
|
+ payTime = Optional.ofNullable(orderDon.getPayTime()).orElse(orderDon.getCreatedTime());
|
|
|
|
|
+ }
|
|
|
|
|
+ //加购订单
|
|
|
|
|
+ if (orderDon == null) {
|
|
|
|
|
+ List<OrderDiscountPlusPurchaseSkuRelation> plusPurchaseSkuRelations = orderDiscountPlusPurchaseSkuRelationMapper.selectPlusRelationByIdAndUserId(ticket.getRelationId(), ticket.getUserId());
|
|
|
|
|
+ for (OrderDiscountPlusPurchaseSkuRelation data : plusPurchaseSkuRelations) {
|
|
|
|
|
+ String relationIds = data.getRelationIds();
|
|
|
|
|
+ if (StrUtil.isEmpty(relationIds)) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ try {
|
|
|
|
|
+ List<Long> relationList = Jsons.parseList(relationIds, Long.class);
|
|
|
|
|
+ if (relationList.contains(ticket.getRelationId())) {
|
|
|
|
|
+ OrderDon plusOrder = orderDonMapper.selectById(data.getOrderId());
|
|
|
|
|
+ if (plusOrder != null) {
|
|
|
|
|
+ payTime = Optional.ofNullable(plusOrder.getPayTime()).orElse(plusOrder.getCreatedTime());
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ ticket.setPayTime(payTime);
|
|
|
|
|
+ }
|
|
|
List<GroupsRelationUserView> relationUserViews = groupsRelationMapper.getUserRelationUserViews(ticket.getGroupId(), ticket.getRelationId(), ticket.getUserId(), List.of(GroupsRelation.Status.validity, GroupsRelation.Status.outside));
|
|
List<GroupsRelationUserView> relationUserViews = groupsRelationMapper.getUserRelationUserViews(ticket.getGroupId(), ticket.getRelationId(), ticket.getUserId(), List.of(GroupsRelation.Status.validity, GroupsRelation.Status.outside));
|
|
|
ticket.setRelationViews(relationUserViews);
|
|
ticket.setRelationViews(relationUserViews);
|
|
|
if (ticket.getExpiryTime() != null) {
|
|
if (ticket.getExpiryTime() != null) {
|
|
|
ticket.setExpiryTimeStr(DateUtil.format(ticket.getExpiryTime(), "yyyy-MM-dd"));
|
|
ticket.setExpiryTimeStr(DateUtil.format(ticket.getExpiryTime(), "yyyy-MM-dd"));
|
|
|
}
|
|
}
|
|
|
- return true;
|
|
|
|
|
- }).collect(Collectors.toList());
|
|
|
|
|
- return collect;
|
|
|
|
|
|
|
+ //查看双重验证码
|
|
|
|
|
+ if (StrUtil.isNotEmpty(ticket.getApiSecret())) {
|
|
|
|
|
+ Boolean isHasVerifyCode = StrUtil.isNotBlank(ticket.getVerifyCode()) ? true : false;
|
|
|
|
|
+ Integer codeNum = getUserCodeNumBySkuId(ticket.getUserId(), ticket.getSkuId(), isHasVerifyCode);
|
|
|
|
|
+ ticket.setCodeNum(codeNum);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ userLoginRecordService.saveUserLoginDayRecord(userId);
|
|
|
|
|
+ return list;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -231,23 +307,27 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@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);
|
|
List<Long> relationUserIdList = userBindRelationService.getRelationUserIdList(userId, null);
|
|
|
RenewalView renewalView = beanSearcher.searchFirst(RenewalView.class, MapUtils.builder().field(RenewalView::getUserId, relationUserIdList).op(Operator.InList)
|
|
RenewalView renewalView = beanSearcher.searchFirst(RenewalView.class, MapUtils.builder().field(RenewalView::getUserId, relationUserIdList).op(Operator.InList)
|
|
|
.field(RenewalView::getRelationId, relationId).build());
|
|
.field(RenewalView::getRelationId, relationId).build());
|
|
|
if (renewalView == null) {
|
|
if (renewalView == null) {
|
|
|
- throw BusinessRuntimeException.getInstance("您的车票不存在...");
|
|
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance(I18nMessageUtil.getI18nMsg("sys_error"));
|
|
|
}
|
|
}
|
|
|
if (StrUtil.isEmpty(renewalView.getAccount())) {
|
|
if (StrUtil.isEmpty(renewalView.getAccount())) {
|
|
|
- throw BusinessRuntimeException.getInstance("车票未配置账号");
|
|
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance(I18nMessageUtil.getI18nMsg("account_not_set"));
|
|
|
}
|
|
}
|
|
|
String account = renewalView.getAccount();
|
|
String account = renewalView.getAccount();
|
|
|
String password = renewalView.getPassword();
|
|
String password = renewalView.getPassword();
|
|
|
if (StrUtil.hasEmpty(account, password)) {
|
|
if (StrUtil.hasEmpty(account, password)) {
|
|
|
- throw BusinessRuntimeException.getInstance("您的车票账号密码异常,请联系客服...");
|
|
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance(I18nMessageUtil.getI18nMsg("sys_error"));
|
|
|
}
|
|
}
|
|
|
if (renewalView.getAccount().contains(CUI_QIU_EMAIL_SUFFIX)) {
|
|
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)
|
|
SysEmail sysEmail = sysEmailMapper.selectOne(Wrappers.lambdaQuery(SysEmail.class)
|
|
@@ -255,7 +335,7 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
.last("limit 1"));
|
|
.last("limit 1"));
|
|
|
if (sysEmail == null) {
|
|
if (sysEmail == null) {
|
|
|
log.info("获取账号:{}验证码异常,未配置对应系统邮箱", account);
|
|
log.info("获取账号:{}验证码异常,未配置对应系统邮箱", account);
|
|
|
- throw BusinessRuntimeException.getInstance("获取账号验证码异常,请联系客服...");
|
|
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance(I18nMessageUtil.getI18nMsg("obtain_code_error"));
|
|
|
}
|
|
}
|
|
|
String url = "http://yinhelx.com/api/controller.php";
|
|
String url = "http://yinhelx.com/api/controller.php";
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
Map<String, Object> params = new HashMap<>();
|
|
@@ -273,9 +353,9 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
post.form(params);
|
|
post.form(params);
|
|
|
cn.hutool.http.HttpResponse execute = post.execute();
|
|
cn.hutool.http.HttpResponse execute = post.execute();
|
|
|
if (execute.getStatus() != HttpStatus.HTTP_OK) {
|
|
if (execute.getStatus() != HttpStatus.HTTP_OK) {
|
|
|
- throw BusinessRuntimeException.getInstance("获取验证码异常,请联系客服...");
|
|
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance(I18nMessageUtil.getI18nMsg("obtain_code_error"));
|
|
|
}
|
|
}
|
|
|
- String code = getDifferentGoodsCode(renewalView.getGoodsId(), execute.body(), type, sync);
|
|
|
|
|
|
|
+ String code = getDifferentGoodsCode(renewalView.getGoodsId(), execute.body(), type, sync, loginReq.getLinkType());
|
|
|
GroupsRelationLoginCodeRecord record = new GroupsRelationLoginCodeRecord();
|
|
GroupsRelationLoginCodeRecord record = new GroupsRelationLoginCodeRecord();
|
|
|
record.setUserId(userId);
|
|
record.setUserId(userId);
|
|
|
record.setRelationId(relationId);
|
|
record.setRelationId(relationId);
|
|
@@ -330,7 +410,7 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
relation.setNum(nextNum);
|
|
relation.setNum(nextNum);
|
|
|
groupsRelationMapper.insert(relation);
|
|
groupsRelationMapper.insert(relation);
|
|
|
} else {
|
|
} else {
|
|
|
- throw BusinessRuntimeException.getInstance("系统繁忙,请重试...");
|
|
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance(I18nMessageUtil.getI18nMsg("sys_busy_error"));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
groups = groupsMapper.selectById(groupsId);
|
|
groups = groupsMapper.selectById(groupsId);
|
|
@@ -358,7 +438,7 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
if (relation == null) {
|
|
if (relation == null) {
|
|
|
Long groupsId = groups.getId();
|
|
Long groupsId = groups.getId();
|
|
|
TASK_EXECUTOR.execute(() -> groupsMapper.updateAvailableNum(groupsId));
|
|
TASK_EXECUTOR.execute(() -> groupsMapper.updateAvailableNum(groupsId));
|
|
|
- throw BusinessRuntimeException.getInstance("系统繁忙,请重试...");
|
|
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance(I18nMessageUtil.getI18nMsg("sys_busy_error"));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -374,7 +454,7 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
- 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;
|
|
String code = null;
|
|
|
//奈飞
|
|
//奈飞
|
|
|
if (goodsId == 1) {
|
|
if (goodsId == 1) {
|
|
@@ -386,21 +466,25 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if (StrUtil.isEmpty(code)) {
|
|
if (StrUtil.isEmpty(code)) {
|
|
|
- throw BusinessRuntimeException.getInstance("查询失败,请检查是否发送了登陆码..");
|
|
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance(I18nMessageUtil.getI18nMsg("ticket_login_code"));
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} 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";
|
|
urlPref = "https://www.netflix.com/account/travel/verify";
|
|
|
code = StrUtil.subBetween(body, "[" + urlPref, "]");
|
|
code = StrUtil.subBetween(body, "[" + urlPref, "]");
|
|
|
- if (StrUtil.isEmpty(code)) {
|
|
|
|
|
- throw BusinessRuntimeException.getInstance("获取认证链接失败,请重新获取");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StrUtil.isEmpty(code)) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance(I18nMessageUtil.getI18nMsg("ticket_verify_link_error"));
|
|
|
}
|
|
}
|
|
|
String url = urlPref + code;
|
|
String url = urlPref + code;
|
|
|
//非点击装置同步更新按钮 直接返回链接
|
|
//非点击装置同步更新按钮 直接返回链接
|
|
|
- if (!sync) return url;
|
|
|
|
|
|
|
+ if (linkType == 2) return url;
|
|
|
//失败返回验证链接
|
|
//失败返回验证链接
|
|
|
if (!groupsRelationNetflixService.confirmUpdate(url)) {
|
|
if (!groupsRelationNetflixService.confirmUpdate(url)) {
|
|
|
return url;
|
|
return url;
|
|
@@ -419,8 +503,37 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
code = StringUtil.getVerifyCodePattern(code, length);
|
|
code = StringUtil.getVerifyCodePattern(code, length);
|
|
|
if (!Validator.isNumber(code)) {
|
|
if (!Validator.isNumber(code)) {
|
|
|
log.error("获取账号验证码失败:{}", StrUtil.subSufByLength(code, 512));
|
|
log.error("获取账号验证码失败:{}", StrUtil.subSufByLength(code, 512));
|
|
|
- throw BusinessRuntimeException.getInstance("获取验证码失败,请重新获取..");
|
|
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance(I18nMessageUtil.getI18nMsg("ticket_verify_link_error"));
|
|
|
}
|
|
}
|
|
|
return code.trim();
|
|
return code.trim();
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Integer getUserCodeNumBySkuId(Long userId, Long skuId, Boolean isHasVerifyCode) {
|
|
|
|
|
+ //查看双重验证码
|
|
|
|
|
+ UserFuncProperty userFuncProperty = userFuncPropertyMapper.selectOne(Wrappers.lambdaQuery(UserFuncProperty.class).eq(UserFuncProperty::getUserId, userId).last("limit 1"));
|
|
|
|
|
+ //默认2次
|
|
|
|
|
+ int num = 2;
|
|
|
|
|
+ //有安全码查看次数 置为0
|
|
|
|
|
+ if (isHasVerifyCode) {
|
|
|
|
|
+ num = 0;
|
|
|
|
|
+ return num;
|
|
|
|
|
+ }
|
|
|
|
|
+ //查看双重验证码次数
|
|
|
|
|
+ GoodsDonSku sku = goodsDonSkuMapper.selectById(skuId);
|
|
|
|
|
+ if (sku.getCodeNum() > 0) {
|
|
|
|
|
+ num = sku.getCodeNum();
|
|
|
|
|
+ }
|
|
|
|
|
+ if (userFuncProperty != null) num = userFuncProperty.getVerifyCheckNum();
|
|
|
|
|
+ return num;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<RenewalView> getHasPayGoods(long userId) {
|
|
|
|
|
+ User user = userMapper.selectById(userId);
|
|
|
|
|
+ List<Long> userIds = userBindRelationService.getRelationUserIdList(userId, user);
|
|
|
|
|
+ DateTime now = DateTime.now();
|
|
|
|
|
+ List<RenewalView> list = groupsRelationMapper.getUserHasPayGoods(userIds, now);
|
|
|
|
|
+ return list;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|