修复查动画无法保存图片的问题
This commit is contained in:
parent
7fa6c22ef8
commit
3e709799d2
@ -207,6 +207,7 @@ public class QQBotManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String sendMessage(List<File> imgs,Long qq, String text) {
|
public String sendMessage(List<File> imgs,Long qq, String text) {
|
||||||
|
System.out.println("imgs.size() = " + imgs.size());
|
||||||
if (bot != null) {
|
if (bot != null) {
|
||||||
MessageChainBuilder builder = new MessageChainBuilder();
|
MessageChainBuilder builder = new MessageChainBuilder();
|
||||||
for (File img : imgs) {
|
for (File img : imgs) {
|
||||||
|
@ -83,22 +83,10 @@ public class Bangumi extends Model {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (String img : imgs) {
|
for (String img : imgs) {
|
||||||
HttpTools.download(img,key+".png", new DownloadInterface() {
|
File file = HttpTools.syncDownload(img.replace("http://","https://"), key + ".jpg");
|
||||||
@Override
|
|
||||||
public void onDownload(File file) {
|
|
||||||
super.onDownload(file);
|
|
||||||
files.add(file);
|
files.add(file);
|
||||||
send(imgs.size(),qq, text);
|
send(imgs.size(),qq, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(Exception e) {
|
|
||||||
super.onError(e);
|
|
||||||
index++;
|
|
||||||
send(imgs.size(),qq, text);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void send(int size,Long qq, String text) {
|
private void send(int size,Long qq, String text) {
|
||||||
|
@ -156,25 +156,9 @@ public class HttpTools {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
JSONObject json = new JSONObject();
|
File file = syncDownload("https://lain.bgm.tv/pic/cover/l/6c/2a/302128_qQIjG.jpg", "12345.jpg");
|
||||||
json.put("pid", "102");
|
System.out.println("file.length() = " + file.length());
|
||||||
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" +
|
|
||||||
"®ParamJson=" + 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String donwloadPath = "tmp" + File.separator;
|
private static String donwloadPath = "tmp" + File.separator;
|
||||||
@ -257,14 +241,13 @@ public class HttpTools {
|
|||||||
connection.addRequestProperty("User-Agent", getExtUa());
|
connection.addRequestProperty("User-Agent", getExtUa());
|
||||||
// Log.i(TAG,"获取到网络请求:"+connection.getResponseCode());
|
// Log.i(TAG,"获取到网络请求:"+connection.getResponseCode());
|
||||||
|
|
||||||
|
connection.addRequestProperty("Content-type","image/jpeg");
|
||||||
InputStream inputStream = connection.getInputStream();
|
InputStream inputStream = connection.getInputStream();
|
||||||
jar = new File(donwloadPath + saveName + "_tmp.tmp");
|
jar = new File(donwloadPath + saveName + "_tmp.tmp");
|
||||||
jar.createNewFile();
|
jar.createNewFile();
|
||||||
Log.i("DOWNLOAD", "临时保存文件:" + jar.getAbsolutePath());
|
Log.i("DOWNLOAD", "临时保存文件:" + jar.getAbsolutePath());
|
||||||
OutputStream outputStream = new FileOutputStream(jar);
|
OutputStream outputStream = new FileOutputStream(jar);
|
||||||
byte[] bytes = new byte[1024];
|
byte[] bytes = new byte[1024];
|
||||||
double size = connection.getContentLength();
|
|
||||||
double downSize = 0;
|
double downSize = 0;
|
||||||
int len;
|
int len;
|
||||||
while ((len = inputStream.read(bytes)) > 0) {
|
while ((len = inputStream.read(bytes)) > 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user