|
|
@@ -7,7 +7,7 @@ async function runScript(){
|
|
7
|
7
|
let id,word;
|
|
8
|
8
|
try {
|
|
9
|
9
|
|
|
10
|
|
- const sql="select * from Words where BookID=110 and ExampleSentence is not null order by ID;;"
|
|
|
10
|
+ const sql="select * from Words where BookID=110 and EnglishExplanation<>'' order by ID;"
|
|
11
|
11
|
let list = await commonModel.RunSql(null,sql);
|
|
12
|
12
|
let count=list.length;
|
|
13
|
13
|
|
|
|
@@ -23,27 +23,27 @@ async function runScript(){
|
|
23
|
23
|
id=item.ID;
|
|
24
|
24
|
//获得单词
|
|
25
|
25
|
word=item.Word;
|
|
26
|
|
- let exampleSentence=item.ExampleSentence;
|
|
27
|
|
- if (exampleSentence){
|
|
|
26
|
+ let EnglishExplanation=item.EnglishExplanation;
|
|
|
27
|
+ if (EnglishExplanation){
|
|
28
|
28
|
try{
|
|
29
|
|
- exampleSentence=JSON.parse(exampleSentence);
|
|
30
|
|
- let sql2="update Words set ExampleSentence=?,Level='"+exampleSentence.CEFR_Level+"' where BookID<>110 and BookID not in (141,142,143,144,145,146,161,162,163,164,165,166,167,168) and ExampleSentence is null and Word='"+word+"';";
|
|
31
|
|
- //console.log(sql2);
|
|
32
|
|
- await commonModel.RunSql(item.ExampleSentence,sql2);
|
|
|
29
|
+ EnglishExplanation=JSON.parse(EnglishExplanation);
|
|
|
30
|
+ // let sql2="update Words set EnglishExplanation=? where BookID<>110 and BookID not in (141,142,143,144,145,146,161,162,163,164,165,166,167,168) and Word='"+word+"';";
|
|
|
31
|
+ // //console.log(sql2);
|
|
|
32
|
+ // await commonModel.RunSql(item.ExampleSentence,sql2);
|
|
33
|
33
|
}
|
|
34
|
34
|
catch(e){
|
|
35
|
|
- //let sql2="update Words set ExampleSentence='' where ID="+id+";";
|
|
36
|
|
- console.log("出错:"+word);
|
|
|
35
|
+ let sql2="update Words set EnglishExplanation='' where ID="+id+";";
|
|
|
36
|
+ await commonModel.RunSql(item.EnglishExplanation,sql2);
|
|
|
37
|
+ console.log("出错:"+word+ " error:"+e);
|
|
37
|
38
|
|
|
38
|
|
- process.exit(1);
|
|
39
|
|
- //await commonModel.RunSql(item.ExampleSentence,sql2);
|
|
|
39
|
+ //process.exit(1);
|
|
40
|
40
|
}
|
|
41
|
41
|
}
|
|
42
|
42
|
else{
|
|
43
|
43
|
console.log( word +" 空");
|
|
44
|
44
|
process.exit(1);
|
|
45
|
45
|
}
|
|
46
|
|
- console.log( i +"/"+ list.length);
|
|
|
46
|
+ //console.log( i +"/"+ list.length);
|
|
47
|
47
|
|
|
48
|
48
|
// 在每次请求后添加延时,除非是最后一个请求
|
|
49
|
49
|
// if (i < count - 1) {
|
|
|
@@ -54,7 +54,7 @@ async function runScript(){
|
|
54
|
54
|
|
|
55
|
55
|
console.log("完成");
|
|
56
|
56
|
|
|
57
|
|
- process.exit(1);
|
|
|
57
|
+ process.exit(1);
|
|
58
|
58
|
} catch (error) {
|
|
59
|
59
|
console.log(id + " " +word);
|
|
60
|
60
|
console.error('Error executing script:', error);
|