|
|
@@ -0,0 +1,143 @@
|
|
|
+package com.yhlxj.service.common;
|
|
|
+
|
|
|
+import cn.hutool.core.util.RandomUtil;
|
|
|
+import cn.hutool.json.JSONObject;
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
+import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
+import com.cyksj.common.util.Jsons;
|
|
|
+import lombok.Data;
|
|
|
+import org.springframework.http.*;
|
|
|
+import org.springframework.web.client.RestTemplate;
|
|
|
+import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
+
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Random;
|
|
|
+
|
|
|
+public class AccountService {
|
|
|
+
|
|
|
+ private static final String URL = "http://147.79.20.196:8086/mj/admin/account";
|
|
|
+ private final RestTemplate restTemplate = new RestTemplate();
|
|
|
+
|
|
|
+ public void addAccount(String rawAccountStr) {
|
|
|
+ try {
|
|
|
+ String[] parts = rawAccountStr.split("----");
|
|
|
+ if (parts.length != 4) {
|
|
|
+ System.err.println("账号格式错误");
|
|
|
+ }
|
|
|
+ // 账号邮箱
|
|
|
+ String email = parts[0];
|
|
|
+ // 密码
|
|
|
+ String password = parts[1];
|
|
|
+ // https2fa及代码,暂时不处理
|
|
|
+ String urlAndCodes = parts[2];
|
|
|
+ // userToken和guildId、channelId
|
|
|
+ String tokenAndIds = parts[3];
|
|
|
+
|
|
|
+ String[] tokenParts = tokenAndIds.split("/");
|
|
|
+ if (tokenParts.length != 3) {
|
|
|
+ System.err.println("token和ID格式错误");
|
|
|
+ }
|
|
|
+ String userToken = tokenParts[0];
|
|
|
+ String guildId = tokenParts[1];
|
|
|
+ String channelId = tokenParts[2];
|
|
|
+ AccountRequestBody body = new AccountRequestBody();
|
|
|
+ body.setGuildId(guildId);
|
|
|
+ body.setChannelId(channelId);
|
|
|
+ body.setUserToken(userToken);
|
|
|
+ body.setBotToken("");
|
|
|
+ body.setUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36");
|
|
|
+ body.setEnable(true);
|
|
|
+ body.setEnableFastToRelax(true);
|
|
|
+ body.setAllowModes(List.of("FAST"));
|
|
|
+ body.setEnableAutoSetRelax(true);
|
|
|
+ body.setCoreSize(3);
|
|
|
+ body.setQueueSize(10);
|
|
|
+ body.setMaxQueueSize(100);
|
|
|
+ body.setInterval(RandomUtil.randomInt(11,15));
|
|
|
+ body.setAfterIntervalMin(RandomUtil.randomInt(30,40));
|
|
|
+ body.setAfterIntervalMax(RandomUtil.randomInt(50,60));
|
|
|
+ body.setEnableMj(true);
|
|
|
+ body.setEnableNiji(false);
|
|
|
+ body.setBlend(true);
|
|
|
+ body.setDescribe(true);
|
|
|
+ body.setShorten(true);
|
|
|
+ body.setDayDrawLimit(-1);
|
|
|
+ body.setPrivateChannelId("");
|
|
|
+ body.setNijiBotChannelId("");
|
|
|
+ body.setTimeoutMinutes(10);
|
|
|
+ body.setSponsor("1");
|
|
|
+ body.setRemark("00:00-08:30" + email);
|
|
|
+ body.setFishingTime("00:00-08:30");
|
|
|
+ body.setSubChannels(List.of());
|
|
|
+ body.setLoginAccount("");
|
|
|
+ body.setLoginPassword("");
|
|
|
+ body.setLogin2fa("");
|
|
|
+
|
|
|
+ addAcount(body);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ private void addAcount(AccountRequestBody accountRequestBody) throws Exception {
|
|
|
+ String body = cn.hutool.http.HttpRequest.post(URL).body(Jsons.toJson(accountRequestBody)).header("mj-api-secret","chen188710").execute().body();
|
|
|
+ System.out.println("addAccount body:" + body);
|
|
|
+ JSONObject jsonObject = JSONUtil.parseObj(body);
|
|
|
+ if (jsonObject.getInt("code") != 0) {
|
|
|
+ throw BusinessRuntimeException.getInstance("addAccount error message:" + jsonObject.getStr("message"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Data
|
|
|
+ public static class AccountRequestBody {
|
|
|
+ private String guildId;
|
|
|
+ private String channelId;
|
|
|
+ private String userToken;
|
|
|
+ private String botToken;
|
|
|
+ private String userAgent;
|
|
|
+ private boolean enable;
|
|
|
+ private boolean enableFastToRelax;
|
|
|
+ private List<String> allowModes;
|
|
|
+ private boolean enableAutoSetRelax;
|
|
|
+ private int coreSize;
|
|
|
+ private int queueSize;
|
|
|
+ private int maxQueueSize;
|
|
|
+ private int interval;
|
|
|
+ private int afterIntervalMin;
|
|
|
+ private int afterIntervalMax;
|
|
|
+ private boolean enableMj;
|
|
|
+ private boolean enableNiji;
|
|
|
+ private boolean isBlend;
|
|
|
+ private boolean isDescribe;
|
|
|
+ private boolean isShorten;
|
|
|
+ private int dayDrawLimit;
|
|
|
+ private String privateChannelId;
|
|
|
+ private String nijiBotChannelId;
|
|
|
+ private int timeoutMinutes;
|
|
|
+ private String sponsor;
|
|
|
+ private String remark;
|
|
|
+ private String fishingTime;
|
|
|
+ private List<String> subChannels;
|
|
|
+ private String loginAccount;
|
|
|
+ private String loginPassword;
|
|
|
+ private String login2fa;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void addAccounts(List<String> rawAccounts) {
|
|
|
+ for (String accountStr : rawAccounts) {
|
|
|
+ addAccount(accountStr);
|
|
|
+ try {
|
|
|
+ Thread.sleep(500);
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void main(String[] args) {
|
|
|
+ String rawAccountsStr = "aoumqqy68ul7@outlook.com----aeh45w90cTjA----https://2fa.run/2fa/v6jq qa5u iump edep g2ts pydt 266x f5oo----MTM5MDYzMTIzMzAyMDQ5NzkyMA.GwhYWx.8BkXeIvaSiJdGVlJ-4W9RhzfOKGETNDTD6XSxc/1393496221909389423/1393496222425415773";
|
|
|
+ List<String> accountList = Arrays.asList(rawAccountsStr.split("\n"));
|
|
|
+ AccountService service = new AccountService();
|
|
|
+ service.addAccounts(accountList);
|
|
|
+ }
|
|
|
+}
|