|
|
@@ -41,8 +41,10 @@ public class CuiQiuMailServiceImpl implements CuiQiuMailService {
|
|
|
//PS 验证码官方
|
|
|
private final static String PS_ADOBE = "Adobe";
|
|
|
|
|
|
+ private final static String DISNEY = "Disney+";
|
|
|
+
|
|
|
@Override
|
|
|
- public String getVerifyCode(String email) throws Exception {
|
|
|
+ public String getVerifyCode(String email, Long goodsId) throws Exception {
|
|
|
//获取近二十封邮件
|
|
|
String url = "https://domain-open-api.cuiqiu.com/v1/message/list";
|
|
|
|
|
|
@@ -67,8 +69,15 @@ public class CuiQiuMailServiceImpl implements CuiQiuMailService {
|
|
|
list = list.stream().filter(emailInfo -> {
|
|
|
CuiQiuEmailDto.CuiQiuUser from = emailInfo.getFrom().get(0);
|
|
|
CuiQiuEmailDto.CuiQiuUser cuiQiuUser = emailInfo.getTo().get(0);
|
|
|
- if (StrUtil.equals(from.getName(), PS_ADOBE) && StrUtil.equals(cuiQiuUser.getAddress(), email)) {
|
|
|
- return true;
|
|
|
+ if (StrUtil.equalsIgnoreCase(cuiQiuUser.getAddress(), email)) {
|
|
|
+ //PS
|
|
|
+ if (goodsId == 33l && StrUtil.equals(from.getName(), PS_ADOBE)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ //Disney
|
|
|
+ if (goodsId == 3l && StrUtil.equals(from.getName(), DISNEY)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|
|
|
return false;
|
|
|
}).collect(Collectors.toList());
|
|
|
@@ -77,7 +86,7 @@ public class CuiQiuMailServiceImpl implements CuiQiuMailService {
|
|
|
for (CuiQiuEmailDto cuiQiuEmailDto : list) {
|
|
|
Long messageId = cuiQiuEmailDto.getId();
|
|
|
try {
|
|
|
- String code = getVerifyCodeByEmail(messageId);
|
|
|
+ String code = getVerifyCodeByEmail(messageId, goodsId);
|
|
|
if (StrUtil.isNotBlank(code)) {
|
|
|
return code;
|
|
|
}
|
|
|
@@ -88,7 +97,7 @@ public class CuiQiuMailServiceImpl implements CuiQiuMailService {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- public String getVerifyCodeByEmail(Long messageId) throws Exception {
|
|
|
+ public String getVerifyCodeByEmail(Long messageId, Long goodsId) throws Exception {
|
|
|
String url = "https://domain-open-api.cuiqiu.com/v1/message/detail";
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
|
params.put("token", CUI_QIU_TOKEN);
|
|
|
@@ -102,7 +111,13 @@ public class CuiQiuMailServiceImpl implements CuiQiuMailService {
|
|
|
CuiQiuEmailDetailDto.Content content = cuiQiuEmailDetailDto.getData().getContent();
|
|
|
|
|
|
String contentBody = content.getBody();
|
|
|
- String str = "color:#505050; font-family:adobe-clean, Helvetica Neue, Helvetica, Verdana, Arial, sans-serif;";
|
|
|
+ String str = null;
|
|
|
+ if (goodsId == 33l) {
|
|
|
+ str = "color:#505050; font-family:adobe-clean, Helvetica Neue, Helvetica, Verdana, Arial, sans-serif;";
|
|
|
+ }
|
|
|
+ if (goodsId == 3l) {
|
|
|
+ str = "'Noto Sans Display', Arial, sans-serif; letter-spacing:4px;";
|
|
|
+ }
|
|
|
String code = StrUtil.subWithLength(contentBody, contentBody.indexOf(str), 512);
|
|
|
if (StrUtil.isNotBlank(code)) {
|
|
|
code = code.replace(str, "");
|