修复查动画无法保存图片的问题

This commit is contained in:
Yutousama 2022-04-08 17:33:17 +08:00
parent 7fa6c22ef8
commit 3e709799d2
3 changed files with 8 additions and 36 deletions

View File

@ -207,6 +207,7 @@ public class QQBotManager {
}
public String sendMessage(List<File> imgs,Long qq, String text) {
System.out.println("imgs.size() = " + imgs.size());
if (bot != null) {
MessageChainBuilder builder = new MessageChainBuilder();
for (File img : imgs) {

View File

@ -83,21 +83,9 @@ public class Bangumi extends Model {
return;
}
for (String img : imgs) {
HttpTools.download(img,key+".png", new DownloadInterface() {
@Override
public void onDownload(File file) {
super.onDownload(file);
files.add(file);
send(imgs.size(),qq, text);
}
@Override
public void onError(Exception e) {
super.onError(e);
index++;
send(imgs.size(),qq, text);
}
});
File file = HttpTools.syncDownload(img.replace("http://","https://"), key + ".jpg");
files.add(file);
send(imgs.size(),qq, text);
}
}

View File

@ -156,25 +156,9 @@ public class HttpTools {
}
public static void main(String[] args) {
JSONObject json = new JSONObject();
json.put("pid", "102");
json.put("gid", "100584");
json.put("gameKey", "0gha58u1c9FjZkeAsEmYIzTvp");
json.put("access_token", "659c-S1gV0DwMXdYjPDlSrSLNYOvA8qUoCSvmdFEHvZugKgNX4Z2BCwF18A7W2gRdG7WiWfKsbZgF6YssZHhaozksI9RBn2QQFTXzmAHtbMd4ginEEtwdKmPCM4JbJGg1ollqoNE0PcGENpa4F3e7EdSOa_JFyE6XyUQN1iurJU3F8MZfLlTIcTR9USYoHX15vsAkCht_0mrapZblkeY1_8HFrmK8rlenbZLxccy7PrMz5eZ9uPPDJL5OYiEahyrtLENB8SVmlGofJfQw8wUjN8_XVZSfLMujdwz24");
String url = "http://192.168.1.156:9020/Faxing/reg?" +
"&tpyeCode=dimai" +
"&regParamJson=" + json.toJSONString();
/* ExecutorService service= Executors.newCachedThreadPool();
for (int i = 0; i < 3000; i++) {
service.submit(new Runnable() {
@Override
public void run() {
get(url);
}
});
}*/
Log.i(url);
//String str=get(url);
File file = syncDownload("https://lain.bgm.tv/pic/cover/l/6c/2a/302128_qQIjG.jpg", "12345.jpg");
System.out.println("file.length() = " + file.length());
}
private static String donwloadPath = "tmp" + File.separator;
@ -257,14 +241,13 @@ public class HttpTools {
connection.addRequestProperty("User-Agent", getExtUa());
// Log.i(TAG,"获取到网络请求:"+connection.getResponseCode());
connection.addRequestProperty("Content-type","image/jpeg");
InputStream inputStream = connection.getInputStream();
jar = new File(donwloadPath + saveName + "_tmp.tmp");
jar.createNewFile();
Log.i("DOWNLOAD", "临时保存文件:" + jar.getAbsolutePath());
OutputStream outputStream = new FileOutputStream(jar);
byte[] bytes = new byte[1024];
double size = connection.getContentLength();
double downSize = 0;
int len;
while ((len = inputStream.read(bytes)) > 0) {