|
|
@@ -6,10 +6,12 @@ import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.lang.Assert;
|
|
|
import cn.hutool.core.lang.Validator;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import cn.hutool.http.HttpStatus;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.cyksj.common.constant.Constant;
|
|
|
import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
+import com.cyksj.common.util.J11HttpC;
|
|
|
import com.cyksj.common.util.Jsons;
|
|
|
import com.cyksj.enums.GatewayApiCode;
|
|
|
import com.cyksj.mapper.*;
|
|
|
@@ -34,6 +36,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.net.http.HttpResponse;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
@@ -80,6 +83,8 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
|
|
|
private final OrderDiscountPlusPurchaseSkuRelationMapper orderDiscountPlusPurchaseSkuRelationMapper;
|
|
|
|
|
|
+ private final static String VERIFY_CODE_SECRET = "q1w2e3";
|
|
|
+
|
|
|
@Override
|
|
|
public List<RenewalView> getMyTicket(long userId, Boolean isLoginPopularize, String customId) {
|
|
|
User u = userMapper.selectById(userId);
|
|
|
@@ -369,4 +374,32 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
}
|
|
|
return relation;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String getAiVerifyCode(Long userId, Long relationId) throws Exception {
|
|
|
+ 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());
|
|
|
+ if (renewalView == null) {
|
|
|
+ throw BusinessRuntimeException.getInstance("您的车票不存在...");
|
|
|
+ }
|
|
|
+ String account = renewalView.getAccount();
|
|
|
+ String password = renewalView.getPassword();
|
|
|
+ if (StrUtil.hasEmpty(account, password)) {
|
|
|
+ throw BusinessRuntimeException.getInstance("您的车票账号密码异常,请联系客服...");
|
|
|
+ }
|
|
|
+ String url = String.format("http://yinhelx.com/api/imap_yhcz.php?sc=&id=&yhm=%s&mm=%s&duan_kou=143&ip=127.0.0.1&mi_yao=%s", account, password, VERIFY_CODE_SECRET);
|
|
|
+ HttpResponse<String> send = J11HttpC.custom()
|
|
|
+ .ofGet()
|
|
|
+ .url(url)
|
|
|
+ .send(HttpResponse.BodyHandlers.ofString());
|
|
|
+ if (send.statusCode() != HttpStatus.HTTP_OK) {
|
|
|
+ throw BusinessRuntimeException.getInstance("获取验证码失败...");
|
|
|
+ }
|
|
|
+ String code = StrUtil.subBetween(send.body(), "Doğrulama kodunuz:", "Bu istek sizin");
|
|
|
+ if (StrUtil.isEmpty(code)) {
|
|
|
+ throw BusinessRuntimeException.getInstance("获取验证码失败...");
|
|
|
+ }
|
|
|
+ return code.trim();
|
|
|
+ }
|
|
|
}
|