update
This commit is contained in:
@@ -17,29 +17,32 @@ public class BotTools {
|
||||
String _json = new String(Base64.getDecoder().decode(msg));
|
||||
JSONObject json = JSONObject.parseObject(_json);
|
||||
String url = json.getString("url");
|
||||
Tools.download(url, new DownloadInterface() {
|
||||
@Override
|
||||
public void onDownload(String file) {
|
||||
super.onDownload(file);
|
||||
if (file.endsWith(".apk")) {
|
||||
String uuid = UUID.randomUUID().toString().replace("-", "").toLowerCase();
|
||||
Jedis redisTools = RedisTools.getRedis();
|
||||
redisTools.select(1);
|
||||
redisTools.setex("downloadApk_" + uuid, RedisTools.TOKEN_TIMEOUT_DEFAULT, file);
|
||||
redisTools.close();
|
||||
RedisTools.set(1, "msg_" + System.currentTimeMillis(), "检测到上传apk,请选择处理方式:" +
|
||||
"\n1)生成穿山甲资源包 (回复 #csj#穿山甲包名#穿山甲版本号#downloadApk_" + uuid + ")" +
|
||||
"\n2)不处理 (360s后自动取消)" +
|
||||
"\n$downloadApk_" + uuid);
|
||||
if(url.endsWith(".apk")){
|
||||
Tools.download(url, new DownloadInterface() {
|
||||
@Override
|
||||
public void onDownload(String file) {
|
||||
super.onDownload(file);
|
||||
if (file.endsWith(".apk")) {
|
||||
String uuid = UUID.randomUUID().toString().replace("-", "").toLowerCase();
|
||||
Jedis redisTools = RedisTools.getRedis();
|
||||
redisTools.select(1);
|
||||
redisTools.setex("downloadApk_" + uuid, RedisTools.TOKEN_TIMEOUT_DEFAULT, file);
|
||||
redisTools.close();
|
||||
RedisTools.set(1, "msg_" + System.currentTimeMillis(), "检测到上传apk,请选择处理方式:" +
|
||||
"\n1)生成穿山甲资源包 (回复 #csj#穿山甲包名#穿山甲版本号#downloadApk_" + uuid + ")" +
|
||||
"\n2)不处理 (360s后自动取消)" +
|
||||
"\n$downloadApk_" + uuid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception e) {
|
||||
super.onError(e);
|
||||
@Override
|
||||
public void onError(Exception e) {
|
||||
super.onError(e);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
return "ok";
|
||||
}
|
||||
|
||||
@@ -68,6 +71,8 @@ public class BotTools {
|
||||
list.clear();
|
||||
for (JSONObject jsonObject : tmp) {
|
||||
isRun=true;
|
||||
long startTime=System.currentTimeMillis();
|
||||
File apk=new File(jsonObject.getString("file"));
|
||||
new CsjTools(jsonObject.getString("file")
|
||||
, new File("csj" + File.separator + "demo.apk").getAbsolutePath()
|
||||
, jsonObject.getString("packagename")
|
||||
@@ -80,13 +85,29 @@ public class BotTools {
|
||||
@Override
|
||||
public void onDownload(String file) {
|
||||
super.onDownload(file);
|
||||
File apk=new File(s);
|
||||
long nowTime=System.currentTimeMillis()-startTime;
|
||||
RedisTools.set(1,"msg_"+System.currentTimeMillis(),apk.getName()
|
||||
+"已处理完成,下载地址" +
|
||||
"\n"+file +
|
||||
"\n请在十分钟内下载,超时将自动删除");
|
||||
"\n请在十分钟内下载,超时将自动删除" +
|
||||
"\n耗时:"+nowTime+"ms");
|
||||
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() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -104,20 +125,7 @@ public class BotTools {
|
||||
});
|
||||
}
|
||||
}
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
if (list.size() > 0) {
|
||||
csj();
|
||||
}
|
||||
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user