-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path下载.js
55 lines (46 loc) · 1.09 KB
/
下载.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//路径
var path6 = files.getSdcardPath() + "/Android/data/com.up366.answer/files/";
//MP3缓存路径
var pathmp3 = path6 + "mp3/1.mp3"
//url
var urlmp3 = "";
//JS缓存路径
var path2 = path6 + "js/";
var JS1 = path2 + "exam-zdcs.js";
var JS2 = path2 + "U3CompoLib.js";
//url
var urljs = "";
var urljs1 = urljs + "";
var urljs2 = urljs + "";
//提示版本
//配置文件URL
var url = "";
var res = http.get(url);
if (res.statusCode == 200) {
let A = res.body.string();
confirm("下载\n资源包版本:" + A )
files.write(path6 + "/download.txt", A);
} else {
toast("请检查网络");
}
//下载MP3
var res = http.get(urlmp3);
if(res.statusCode != 200){
toast("请求失败");
}
files.writeBytes(pathmp3, res.body.bytes());
toast("mp3下载成功");
//下载JS1
var res = http.get(urljs1);
if(res.statusCode != 200){
toast("请求失败");
}
files.writeBytes(JS1, res.body.bytes());
toast("JS1下载成功");
//下载JS2
var res = http.get(urljs2);
if(res.statusCode != 200){
toast("请求失败");
}
files.writeBytes(JS2, res.body.bytes());
toast("JS2下载成功");