|
|
@@ -1,5 +1,6 @@
|
|
|
package com.cyksj.service.mail.impl;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.http.HttpRequest;
|
|
|
@@ -9,16 +10,20 @@ import cn.hutool.json.JSONObject;
|
|
|
import com.cyksj.common.constant.Constant;
|
|
|
import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
import com.cyksj.common.util.Jsons;
|
|
|
+import com.cyksj.common.util.StringUtil;
|
|
|
import com.cyksj.common.util.TicketCodeCommonUtil;
|
|
|
+import com.cyksj.model.response.AdobeEmailResp;
|
|
|
import com.cyksj.model.response.DisneyCodeResp;
|
|
|
import com.cyksj.service.mail.CommonMailService;
|
|
|
import com.cyksj.service.mail.CuiQiuMailService;
|
|
|
import com.cyksj.service.mail.MailLuService;
|
|
|
import com.cyksj.service.mail.YhMailService;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* 项目名: yhlxj
|
|
|
@@ -28,6 +33,7 @@ import java.util.Date;
|
|
|
*/
|
|
|
@Service
|
|
|
@RequiredArgsConstructor
|
|
|
+@Slf4j
|
|
|
public class CommonMailServiceImpl implements CommonMailService {
|
|
|
private final CuiQiuMailService cuiQiuMailService;
|
|
|
|
|
|
@@ -55,21 +61,48 @@ public class CommonMailServiceImpl implements CommonMailService {
|
|
|
}
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//迪士尼 获取验证码
|
|
|
if (goodsId == Constant.DISNEY_GID) {
|
|
|
- String url = "https://32t.cn/api/v1/code/" + emailPwd;
|
|
|
- HttpRequest post = HttpUtil.createGet(url);
|
|
|
- HttpResponse execute = post.execute();
|
|
|
- JSONObject resp = Jsons.parseObject(execute.body(), JSONObject.class);
|
|
|
- Object data = resp.getObj("data");
|
|
|
- if (data != null) {
|
|
|
- DisneyCodeResp codeData = Jsons.parseObject(data, DisneyCodeResp.class);
|
|
|
- return codeData.getCode();
|
|
|
+ try {
|
|
|
+ String url = "https://32t.cn/api/v1/code/" + emailPwd;
|
|
|
+ HttpRequest post = HttpUtil.createGet(url);
|
|
|
+ HttpResponse execute = post.execute();
|
|
|
+ JSONObject resp = Jsons.parseObject(execute.body(), JSONObject.class);
|
|
|
+ Object data = resp.getObj("data");
|
|
|
+ if (data != null) {
|
|
|
+ DisneyCodeResp codeData = Jsons.parseObject(data, DisneyCodeResp.class);
|
|
|
+ return codeData.getCode();
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("迪士尼 {}获取验证码失败:{}", account, StringUtil.getErrorMsg(e));
|
|
|
}
|
|
|
}
|
|
|
+ //Adobe 获取验证码
|
|
|
+ if (goodsId == Constant.ADOBE_GOODS_ID) {
|
|
|
+ try {
|
|
|
+ String url = "https://xinapi.adbacc.top/admin/mails?limit=20&offset=0&email=" + account;
|
|
|
+ HttpRequest post = HttpUtil.createGet(url).header("x-admin-auth", "xin456");
|
|
|
+ HttpResponse execute = post.execute();
|
|
|
+ JSONObject resp = Jsons.parseObject(execute.body(), JSONObject.class);
|
|
|
+ List<AdobeEmailResp> AdobeEmailResps = Jsons.parseList(resp.getObj("results"), AdobeEmailResp.class);
|
|
|
+ if (CollUtil.isNotEmpty(AdobeEmailResps)) {
|
|
|
+ for (AdobeEmailResp adobeEmailResp : AdobeEmailResps) {
|
|
|
+ String str = "Your verification code is";
|
|
|
+ if (StrUtil.equals(adobeEmailResp.getAddress(), account) && StrUtil.isNotBlank(adobeEmailResp.getRaw()) && adobeEmailResp.getRaw().contains(str)) {
|
|
|
+ String code = StrUtil.subAfter(adobeEmailResp.getRaw(), str, false);
|
|
|
+ return StringUtil.getVerifyCodePattern(code, 6);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("Adobe {}获取验证码:{}", account, StringUtil.getErrorMsg(e));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
String checkEmail = StrUtil.isNotEmpty(relateEmail) ? relateEmail : account;
|
|
|
//关联邮箱
|
|
|
if (cuiQiuMailService.isCuiQiuEmail(checkEmail)) {
|