|
|
@@ -43,6 +43,8 @@ import java.io.BufferedReader;
|
|
|
import java.io.InputStream;
|
|
|
import java.io.InputStreamReader;
|
|
|
import java.util.*;
|
|
|
+import java.util.regex.Matcher;
|
|
|
+import java.util.regex.Pattern;
|
|
|
|
|
|
/**
|
|
|
* @author chan
|
|
|
@@ -284,120 +286,129 @@ public class CmsAccountServiceImpl extends ServiceImpl<AccountMapper, Account> i
|
|
|
Map<String, Object> map = Jsons.toMap(accountData);
|
|
|
Account insert = new Account();
|
|
|
insert.setGoodsId(goodsId);
|
|
|
- if (map.keySet().size() >= 5) {
|
|
|
- String account = map.get("0").toString();
|
|
|
- String password = map.get("1").toString();
|
|
|
- String friend = map.get("2").toString();
|
|
|
- String work = map.get("3").toString();
|
|
|
- String parents = map.get("4").toString();
|
|
|
- String secret;
|
|
|
- if (map.keySet().size() == 6) {
|
|
|
- String country = map.get("5").toString();
|
|
|
- secret = String.format(Constant.NEW_APPID_SECRET, friend, work, parents, country);
|
|
|
- } else {
|
|
|
- secret = String.format(Constant.NEW_APPID_NO_COUNTRY_SECRET, friend, work, parents);
|
|
|
+ //Gemini pro批量导入特殊格式
|
|
|
+ if (goodsId == Constant.GEMINI_GOODS_ID) {
|
|
|
+ String info = map.get("0").toString();
|
|
|
+ if (info.contains("2FA验证")) {
|
|
|
+ saveAccount(insert, info);
|
|
|
}
|
|
|
- insert.setAccount(account);
|
|
|
- insert.setPassword(password);
|
|
|
- insert.setSecret(secret);
|
|
|
+
|
|
|
} else {
|
|
|
- String params = map.get("0").toString();
|
|
|
- String[] part;
|
|
|
- //兼容
|
|
|
- if (params.contains(regex2) && !params.contains(regex)) {
|
|
|
- part = params.split(regex2);
|
|
|
- } else {
|
|
|
- part = params.split(regex);
|
|
|
- }
|
|
|
- if (part.length >= 2) {
|
|
|
- String account = part[0];
|
|
|
- String password = part[1];
|
|
|
+ if (map.keySet().size() >= 5) {
|
|
|
+ String account = map.get("0").toString();
|
|
|
+ String password = map.get("1").toString();
|
|
|
+ String friend = map.get("2").toString();
|
|
|
+ String work = map.get("3").toString();
|
|
|
+ String parents = map.get("4").toString();
|
|
|
+ String secret;
|
|
|
+ if (map.keySet().size() == 6) {
|
|
|
+ String country = map.get("5").toString();
|
|
|
+ secret = String.format(Constant.NEW_APPID_SECRET, friend, work, parents, country);
|
|
|
+ } else {
|
|
|
+ secret = String.format(Constant.NEW_APPID_NO_COUNTRY_SECRET, friend, work, parents);
|
|
|
+ }
|
|
|
insert.setAccount(account);
|
|
|
insert.setPassword(password);
|
|
|
- if (part.length > 2 && part.length < 9) {
|
|
|
- //google36、辅助邮箱
|
|
|
- //46 Google Bard
|
|
|
- if (special_email_goods_ids.contains(goodsId)) {
|
|
|
- String email = part[2];
|
|
|
- insert.setEmail(email);
|
|
|
- if (part.length > 3) {
|
|
|
- String googleAuth = part[3];
|
|
|
- insert.setGoogleAuth(googleAuth);
|
|
|
- //google双重认证密钥
|
|
|
- insert.setApiSecret(googleAuth);
|
|
|
- }
|
|
|
- } else {
|
|
|
- //chatGPT 邮箱密码
|
|
|
- String gptEmailPwd = part[2];
|
|
|
- insert.setGptEmailPwd(gptEmailPwd);
|
|
|
- if (gptEmailPwd.contains("http")) {
|
|
|
- insert.setSecret(gptEmailPwd);
|
|
|
- }
|
|
|
- }
|
|
|
+ insert.setSecret(secret);
|
|
|
+ } else {
|
|
|
+ String params = map.get("0").toString();
|
|
|
+ String[] part;
|
|
|
+ //兼容
|
|
|
+ if (params.contains(regex2) && !params.contains(regex)) {
|
|
|
+ part = params.split(regex2);
|
|
|
+ } else {
|
|
|
+ part = params.split(regex);
|
|
|
}
|
|
|
- if (goodsId.equals(31l)) {
|
|
|
- if (part.length >= 9) {
|
|
|
- StringBuilder sb = new StringBuilder();
|
|
|
- String country = part[part.length - 1];
|
|
|
- if (country.contains("国")) {
|
|
|
- sb.append(part[part.length - 1]);
|
|
|
- sb.append(Constant.ONE_EMPTY);
|
|
|
- sb.append(part[part.length - 2]);
|
|
|
- sb.append(Constant.ONE_EMPTY);
|
|
|
- }
|
|
|
- for (int i = 2; i < part.length; i++) {
|
|
|
- if (part[i].contains("朋友")) {
|
|
|
- sb.append("朋友");
|
|
|
- sb.append(Constant.ONE_EMPTY);
|
|
|
- sb.append(part[i + 1]);
|
|
|
- i++;
|
|
|
+ if (part.length >= 2) {
|
|
|
+ String account = part[0];
|
|
|
+ String password = part[1];
|
|
|
+ insert.setAccount(account);
|
|
|
+ insert.setPassword(password);
|
|
|
+ if (part.length > 2 && part.length < 9) {
|
|
|
+ //google36、辅助邮箱
|
|
|
+ //46 Google Bard
|
|
|
+ if (special_email_goods_ids.contains(goodsId)) {
|
|
|
+ String email = part[2];
|
|
|
+ insert.setEmail(email);
|
|
|
+ if (part.length > 3) {
|
|
|
+ String googleAuth = part[3];
|
|
|
+ insert.setGoogleAuth(googleAuth);
|
|
|
+ //google双重认证密钥
|
|
|
+ insert.setApiSecret(googleAuth);
|
|
|
}
|
|
|
- if (part[i].contains("工作")) {
|
|
|
- sb.append("工作");
|
|
|
- sb.append(Constant.ONE_EMPTY);
|
|
|
- sb.append(part[i + 1]);
|
|
|
- i++;
|
|
|
+ } else {
|
|
|
+ //chatGPT 邮箱密码
|
|
|
+ String gptEmailPwd = part[2];
|
|
|
+ insert.setGptEmailPwd(gptEmailPwd);
|
|
|
+ if (gptEmailPwd.contains("http")) {
|
|
|
+ insert.setSecret(gptEmailPwd);
|
|
|
}
|
|
|
- if (part[i].contains("父母")) {
|
|
|
- sb.append("父母");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (goodsId.equals(31l)) {
|
|
|
+ if (part.length >= 9) {
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ String country = part[part.length - 1];
|
|
|
+ if (country.contains("国")) {
|
|
|
+ sb.append(part[part.length - 1]);
|
|
|
sb.append(Constant.ONE_EMPTY);
|
|
|
- sb.append(part[i + 1]);
|
|
|
- i++;
|
|
|
- }
|
|
|
- if (part[i].contains("菜")) {
|
|
|
- sb.append("一道菜");
|
|
|
+ sb.append(part[part.length - 2]);
|
|
|
sb.append(Constant.ONE_EMPTY);
|
|
|
- sb.append(part[i + 1]);
|
|
|
- i++;
|
|
|
}
|
|
|
- if (part[i].contains("书")) {
|
|
|
- sb.append("一本书");
|
|
|
- sb.append(Constant.ONE_EMPTY);
|
|
|
- sb.append(part[i + 1]);
|
|
|
- i++;
|
|
|
+ for (int i = 2; i < part.length; i++) {
|
|
|
+ if (part[i].contains("朋友")) {
|
|
|
+ sb.append("朋友");
|
|
|
+ sb.append(Constant.ONE_EMPTY);
|
|
|
+ sb.append(part[i + 1]);
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+ if (part[i].contains("工作")) {
|
|
|
+ sb.append("工作");
|
|
|
+ sb.append(Constant.ONE_EMPTY);
|
|
|
+ sb.append(part[i + 1]);
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+ if (part[i].contains("父母")) {
|
|
|
+ sb.append("父母");
|
|
|
+ sb.append(Constant.ONE_EMPTY);
|
|
|
+ sb.append(part[i + 1]);
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+ if (part[i].contains("菜")) {
|
|
|
+ sb.append("一道菜");
|
|
|
+ sb.append(Constant.ONE_EMPTY);
|
|
|
+ sb.append(part[i + 1]);
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+ if (part[i].contains("书")) {
|
|
|
+ sb.append("一本书");
|
|
|
+ sb.append(Constant.ONE_EMPTY);
|
|
|
+ sb.append(part[i + 1]);
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+ if (part[i].contains("专辑")) {
|
|
|
+ sb.append("一张专辑");
|
|
|
+ sb.append(Constant.ONE_EMPTY);
|
|
|
+ sb.append(part[i + 1]);
|
|
|
+ i++;
|
|
|
+ }
|
|
|
}
|
|
|
- if (part[i].contains("专辑")) {
|
|
|
- sb.append("一张专辑");
|
|
|
- sb.append(Constant.ONE_EMPTY);
|
|
|
- sb.append(part[i + 1]);
|
|
|
- i++;
|
|
|
+ String string = sb.toString();
|
|
|
+ if (string.contains("菜")) {
|
|
|
+ StringBuilder builder = new StringBuilder();
|
|
|
+ string = builder.append("生日").append(Constant.ONE_EMPTY).append(part[2]).append(Constant.ONE_EMPTY).append(string).toString();
|
|
|
+ }
|
|
|
+ insert.setSecret(string);
|
|
|
+ } else {
|
|
|
+ //密保
|
|
|
+ if (part.length > 5) {
|
|
|
+ String friends = part[2];
|
|
|
+ String works = part[3];
|
|
|
+ String parents = part[4];
|
|
|
+ String birthday = part[5];
|
|
|
+ String secret = String.format(Constant.NEW_APPID_NO_COUNTRY_SECRET_DATE, birthday, friends, works, parents);
|
|
|
+ insert.setSecret(secret);
|
|
|
}
|
|
|
- }
|
|
|
- String string = sb.toString();
|
|
|
- if (string.contains("菜")) {
|
|
|
- StringBuilder builder = new StringBuilder();
|
|
|
- string = builder.append("生日").append(Constant.ONE_EMPTY).append(part[2]).append(Constant.ONE_EMPTY).append(string).toString();
|
|
|
- }
|
|
|
- insert.setSecret(string);
|
|
|
- } else {
|
|
|
- //密保
|
|
|
- if (part.length > 5) {
|
|
|
- String friends = part[2];
|
|
|
- String works = part[3];
|
|
|
- String parents = part[4];
|
|
|
- String birthday = part[5];
|
|
|
- String secret = String.format(Constant.NEW_APPID_NO_COUNTRY_SECRET_DATE, birthday, friends, works, parents);
|
|
|
- insert.setSecret(secret);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -435,6 +446,28 @@ public class CmsAccountServiceImpl extends ServiceImpl<AccountMapper, Account> i
|
|
|
redisService.del(cache);
|
|
|
}
|
|
|
|
|
|
+ private void saveAccount(Account insert, String info) {
|
|
|
+ // 定义各项对应的正则表达式
|
|
|
+ String accountRegex = "账号:(.*?)密码:";
|
|
|
+ String passwordRegex = "密码:(.*?)登录二次验证码:";
|
|
|
+ String login2faUrlRegex = "登录二次验证码:(.*?)\\s*2FA验证:"; // \s* 用于处理可能存在的空格
|
|
|
+ String twoFaCodeRegex = "2FA验证:(.*?)美国手机号:";
|
|
|
+ // 获取“美国手机号:”后面的所有字符串(匹配到行尾)
|
|
|
+ String usPhoneAndRestRegex = "美国手机号:(.*)";
|
|
|
+
|
|
|
+ // 提取数据
|
|
|
+ String account = extractValue(info, accountRegex);
|
|
|
+ String password = extractValue(info, passwordRegex);
|
|
|
+ String login2faUrl = extractValue(info, login2faUrlRegex);
|
|
|
+ String twoFaCode = extractValue(info, twoFaCodeRegex);
|
|
|
+ String phoneInfos = extractValue(info, usPhoneAndRestRegex);
|
|
|
+
|
|
|
+ insert.setAccount(account);
|
|
|
+ insert.setPassword(password);
|
|
|
+ insert.setApiSecret(twoFaCode);
|
|
|
+ insert.setEmail("登录二次验证码:" + login2faUrl + " 美国手机号:" + phoneInfos);
|
|
|
+ }
|
|
|
+
|
|
|
public void setGroupsTrips(Long skuId, Long accountId) {
|
|
|
//自动配置车队
|
|
|
GroupsTrips groupsTrips = new GroupsTrips();
|
|
|
@@ -614,4 +647,14 @@ public class CmsAccountServiceImpl extends ServiceImpl<AccountMapper, Account> i
|
|
|
}
|
|
|
return fails;
|
|
|
}
|
|
|
+
|
|
|
+ private String extractValue(String text, String regex) {
|
|
|
+ Pattern pattern = Pattern.compile(regex);
|
|
|
+ Matcher matcher = pattern.matcher(text);
|
|
|
+ if (matcher.find()) {
|
|
|
+ // group(1) 返回第一个括号内匹配的内容,trim() 用于去除首尾多余的空格
|
|
|
+ return matcher.group(1).trim();
|
|
|
+ }
|
|
|
+ return "";
|
|
|
+ }
|
|
|
}
|