update
This commit is contained in:
parent
5d366b8bd1
commit
e614cc6f34
Binary file not shown.
@ -13,6 +13,7 @@ import java.io.File;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class BotTools {
|
public class BotTools {
|
||||||
|
private static Thread runThread=null;
|
||||||
protected static String download(String msg) {
|
protected static String download(String msg) {
|
||||||
String _json = new String(Base64.getDecoder().decode(msg));
|
String _json = new String(Base64.getDecoder().decode(msg));
|
||||||
JSONObject json = JSONObject.parseObject(_json);
|
JSONObject json = JSONObject.parseObject(_json);
|
||||||
@ -29,7 +30,7 @@ public class BotTools {
|
|||||||
redisTools.setex("downloadApk_" + uuid, RedisTools.TOKEN_TIMEOUT_DEFAULT, file);
|
redisTools.setex("downloadApk_" + uuid, RedisTools.TOKEN_TIMEOUT_DEFAULT, file);
|
||||||
redisTools.close();
|
redisTools.close();
|
||||||
RedisTools.set(1, "msg_" + System.currentTimeMillis(), "检测到上传apk,请选择处理方式:" +
|
RedisTools.set(1, "msg_" + System.currentTimeMillis(), "检测到上传apk,请选择处理方式:" +
|
||||||
"\n1)生成穿山甲资源包 (回复 #csj#穿山甲包名#穿山甲版本号#downloadApk_" + uuid + ")" +
|
"\n1)生成穿山甲资源包 回复 #csj#穿山甲包名#穿山甲版本号#downloadApk_" + uuid + "" +
|
||||||
"\n2)不处理 (360s后自动取消)" +
|
"\n2)不处理 (360s后自动取消)" +
|
||||||
"\n$downloadApk_" + uuid);
|
"\n$downloadApk_" + uuid);
|
||||||
}
|
}
|
||||||
@ -61,16 +62,13 @@ public class BotTools {
|
|||||||
RedisTools.set(1, "msg_" + System.currentTimeMillis(), file + "\n已加入到队列");
|
RedisTools.set(1, "msg_" + System.currentTimeMillis(), file + "\n已加入到队列");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
csj();
|
if(runThread==null){
|
||||||
|
runThread=new MyThread();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void csj() {
|
|
||||||
if (list.size() > 0) {
|
private static void csj(JSONObject jsonObject) {
|
||||||
List<JSONObject> tmp = new ArrayList<>(list);
|
|
||||||
list.clear();
|
|
||||||
for (JSONObject jsonObject : tmp) {
|
|
||||||
isRun=true;
|
|
||||||
long startTime=System.currentTimeMillis();
|
long startTime=System.currentTimeMillis();
|
||||||
File apk=new File(jsonObject.getString("file"));
|
File apk=new File(jsonObject.getString("file"));
|
||||||
new CsjTools(jsonObject.getString("file")
|
new CsjTools(jsonObject.getString("file")
|
||||||
@ -92,22 +90,6 @@ public class BotTools {
|
|||||||
"\n请在十分钟内下载,超时将自动删除" +
|
"\n请在十分钟内下载,超时将自动删除" +
|
||||||
"\n耗时:"+nowTime+"ms");
|
"\n耗时:"+nowTime+"ms");
|
||||||
path = file.replace("https://yutou-oss-test.oss-cn-hangzhou.aliyuncs.com/", "");
|
path = file.replace("https://yutou-oss-test.oss-cn-hangzhou.aliyuncs.com/", "");
|
||||||
isRun=false;
|
|
||||||
new Thread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
try {
|
|
||||||
Thread.sleep(100);
|
|
||||||
if (list.size() > 0) {
|
|
||||||
RedisTools.set(1, "msg_" + System.currentTimeMillis(), "开始下一个队列");
|
|
||||||
csj();
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -119,13 +101,39 @@ public class BotTools {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
|
System.gc();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
private static class MyThread extends Thread{
|
||||||
|
public MyThread() {
|
||||||
|
if(runThread!=null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
super.run();
|
||||||
|
while (true){
|
||||||
|
try {
|
||||||
|
Thread.sleep(100);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
if(list.size()!=0){
|
||||||
|
Iterator<JSONObject> iterator=list.iterator();
|
||||||
|
list.clear();
|
||||||
|
isRun=true;
|
||||||
|
while (iterator.hasNext()){
|
||||||
|
JSONObject json=iterator.next();
|
||||||
|
}
|
||||||
|
isRun=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user