owl-cli 6.168.0 → 6.169.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -11,11 +11,18 @@ function main(){
|
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
var s = null;
|
|
14
15
|
var url = batchImport.importFile[0].url;
|
|
15
16
|
if(!url){
|
|
16
17
|
return;
|
|
17
18
|
}
|
|
18
|
-
|
|
19
|
+
if(url.endsWith(".zip")){
|
|
20
|
+
s = $.unzipUrl(url,batchImport.zipPass,batchImport.contentFileName);
|
|
21
|
+
}
|
|
22
|
+
else{
|
|
23
|
+
s = $.get(url);
|
|
24
|
+
}
|
|
25
|
+
|
|
19
26
|
var now = new Date().getTime();
|
|
20
27
|
var log = {
|
|
21
28
|
objId:batchImport.id,
|
|
@@ -27,7 +34,24 @@ function main(){
|
|
|
27
34
|
}
|
|
28
35
|
owl_process_job_logService.add(log);
|
|
29
36
|
|
|
30
|
-
var
|
|
37
|
+
var contentType = batchImport.contentType;
|
|
38
|
+
if(!contentType){
|
|
39
|
+
if(s.startsWith("[")){
|
|
40
|
+
contentType = "json";
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
contentType = "jsonl";
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
var rows = null;
|
|
47
|
+
|
|
48
|
+
if(contentType==="jsonl"){
|
|
49
|
+
rows = s.split("\n");
|
|
50
|
+
}
|
|
51
|
+
else{
|
|
52
|
+
rows = JSON.parse(s);
|
|
53
|
+
}
|
|
54
|
+
|
|
31
55
|
var log = {
|
|
32
56
|
objId:batchImport.id,
|
|
33
57
|
name:"批量导入" + batchImport.id,
|
|
@@ -42,7 +66,13 @@ function main(){
|
|
|
42
66
|
var row = rows[i];
|
|
43
67
|
try{
|
|
44
68
|
var row = rows[i];
|
|
45
|
-
var rec =
|
|
69
|
+
var rec = null;
|
|
70
|
+
if(contentType==="jsonl") {
|
|
71
|
+
rec = JSON.parse(row);
|
|
72
|
+
}
|
|
73
|
+
else{
|
|
74
|
+
rec = row;
|
|
75
|
+
}
|
|
46
76
|
@projectCodeService.add( rec);
|
|
47
77
|
nImported++;
|
|
48
78
|
|