|
|
@@ -5,9 +5,7 @@ import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.http.HttpRequest;
|
|
|
import cn.hutool.http.HttpResponse;
|
|
|
import cn.hutool.http.HttpUtil;
|
|
|
-import cn.hutool.json.JSONObject;
|
|
|
import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
-import com.cyksj.common.util.Jsons;
|
|
|
import com.cyksj.common.util.TicketCodeCommonUtil;
|
|
|
import com.cyksj.service.mail.CommonMailService;
|
|
|
import com.cyksj.service.mail.CuiQiuMailService;
|
|
|
@@ -17,7 +15,6 @@ import lombok.RequiredArgsConstructor;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* 项目名: yhlxj
|
|
|
@@ -44,21 +41,13 @@ public class CommonMailServiceImpl implements CommonMailService {
|
|
|
if (goodsId == 18 && emailCreatedTime.compareTo(DateUtil.parse("2025-01-01")) > 0) {
|
|
|
try {
|
|
|
//获取近十封邮件
|
|
|
- String url = "https://ms.lqqq.cc/" + account + "----" + emailPwd;
|
|
|
+ String url = "https://ms.lqqq.cc/web/" + account + "----" + emailPwd;
|
|
|
HttpRequest post = HttpUtil.createGet(url);
|
|
|
HttpResponse execute = post.execute();
|
|
|
- List<JSONObject> jsonObjects = Jsons.parseList(execute.body(), JSONObject.class);
|
|
|
- if (jsonObjects.size() > 0) {
|
|
|
- int size = jsonObjects.size();
|
|
|
- //获取前10封邮件
|
|
|
- jsonObjects = jsonObjects.subList(0, size > 10 ? 10 : size);
|
|
|
- for (JSONObject jsonObject : jsonObjects) {
|
|
|
- String str = jsonObject.getStr("content");
|
|
|
- if (str.contains("Your ChatGPT code is")) {
|
|
|
- String code = TicketCodeCommonUtil.getTicketCodeStr(str, goodsId);
|
|
|
- return code;
|
|
|
- }
|
|
|
- }
|
|
|
+ String body = execute.body();
|
|
|
+ if (body.contains("Your ChatGPT code is")) {
|
|
|
+ String code = TicketCodeCommonUtil.getTicketCodeStr(body, goodsId);
|
|
|
+ return code;
|
|
|
}
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
@@ -80,22 +69,13 @@ public class CommonMailServiceImpl implements CommonMailService {
|
|
|
|
|
|
@Override
|
|
|
public String getGptChangePwdLink(String email, String password) throws Exception {
|
|
|
- String url = "https://ms.lqqq.cc/" + email + "----" + password;
|
|
|
+ String url = "https://ms.lqqq.cc/web/" + email + "----" + password;
|
|
|
HttpRequest post = HttpUtil.createGet(url);
|
|
|
HttpResponse execute = post.execute();
|
|
|
String body = execute.body();
|
|
|
try {
|
|
|
- List<JSONObject> jsonObjects = Jsons.parseList(body, JSONObject.class);
|
|
|
- if (jsonObjects.size() > 0) {
|
|
|
- Integer size = jsonObjects.size();
|
|
|
- //获取前10封邮件
|
|
|
- jsonObjects = jsonObjects.subList(0, size > 10 ? 10 : size);
|
|
|
- for (JSONObject jsonObject : jsonObjects) {
|
|
|
- String str = jsonObject.getStr("content");
|
|
|
- if (str.contains(GPT_RESET_PWD_LINK_REGEX)) {
|
|
|
- return TicketCodeCommonUtil.extractUrl(str, GPT_RESET_PWD_LINK_REGEX).replaceAll(">", "");
|
|
|
- }
|
|
|
- }
|
|
|
+ if (body.contains(GPT_RESET_PWD_LINK_REGEX)) {
|
|
|
+ return TicketCodeCommonUtil.extractUrl(body, GPT_RESET_PWD_LINK_REGEX).replaceAll(">", "");
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
throw BusinessRuntimeException.getInstance("邮箱或密码错误");
|