chengjie недель назад: 2
Родитель
Сommit
5917694a7b
1 измененных файлов с 139 добавлено и 132 удалено
  1. 139 132
      src/api/mps/mpsScoreController.js

+ 139 - 132
src/api/mps/mpsScoreController.js

@@ -11,21 +11,21 @@ export async function UpdateMPSUserSchoolLikeNum(ctx) {
11 11
     const param = {
12 12
         UserID: ctx.query.UserID || 0,
13 13
         SchoolID: ctx.query.SchoolID || 0,
14
-        ClickLikeID:ctx.query.ClickLikeID || 0,
14
+        ClickLikeID: ctx.query.ClickLikeID || 0,
15 15
     };
16 16
 
17
-    var sql="select * from MPS_UserSchoolClickLike where UserID="+param.UserID+" and SchoolID="+param.SchoolID;
18
-    var list = await commonModel.RunSql(null,sql);
19
-    if (list && list.length>0){
20
-        if (list[0].ClickLikeID!=param.ClickLikeID) {
21
-            param.ID=list[0].ID;
17
+    var sql = "select * from MPS_UserSchoolClickLike where UserID=" + param.UserID + " and SchoolID=" + param.SchoolID;
18
+    var list = await commonModel.RunSql(null, sql);
19
+    if (list && list.length > 0) {
20
+        if (list[0].ClickLikeID != param.ClickLikeID) {
21
+            param.ID = list[0].ID;
22 22
             await mps.UpdateMPSUserSchoolClickLike(param);
23 23
         }
24 24
     }
25
-    else{
25
+    else {
26 26
         await mps.AddMPSUserSchoolClickLike(param);
27 27
     }
28
-    ctx.body = { "errcode": 10000};
28
+    ctx.body = { "errcode": 10000 };
29 29
 }
30 30
 
31 31
 // 获取学校点赞数
@@ -35,15 +35,15 @@ export async function GetMPSSchoolLikeNum(ctx) {
35 35
         UserID: ctx.query.UserID || 0,
36 36
     };
37 37
 
38
-    let sql="select ClickLikeID,count(*) as Count from MPS_UserSchoolClickLike where SchoolID="+param.SchoolID+" group by ClickLikeID order by Count desc,ClickLikeID;";
38
+    let sql = "select ClickLikeID,count(*) as Count from MPS_UserSchoolClickLike where SchoolID=" + param.SchoolID + " group by ClickLikeID order by Count desc,ClickLikeID;";
39 39
     //console.log(sql);
40
-    let list = await commonModel.RunSql(null,sql);
41
-    if (list && list.length>0){
42
-        list[0].Show=1;
43
-        let sql2="select * from MPS_UserSchoolClickLike where SchoolID="+param.SchoolID+" and UserID="+param.UserID+";";
40
+    let list = await commonModel.RunSql(null, sql);
41
+    if (list && list.length > 0) {
42
+        list[0].Show = 1;
43
+        let sql2 = "select * from MPS_UserSchoolClickLike where SchoolID=" + param.SchoolID + " and UserID=" + param.UserID + ";";
44 44
         //console.log(sql2);
45
-        let user=await commonModel.RunSql(null,sql2);
46
-        if (user && user.length>0) {
45
+        let user = await commonModel.RunSql(null, sql2);
46
+        if (user && user.length > 0) {
47 47
             for (let i = 0; i < list.length; i++) {
48 48
                 if (user[0].ClickLikeID == list[i].ClickLikeID) {
49 49
                     list[i].Show = 1;
@@ -51,10 +51,10 @@ export async function GetMPSSchoolLikeNum(ctx) {
51 51
             }
52 52
         }
53 53
 
54
-        ctx.body = {errcode: 10000,result:list};
54
+        ctx.body = { errcode: 10000, result: list };
55 55
     }
56
-    else{
57
-        ctx.body = {errcode: 10000,result:[]};
56
+    else {
57
+        ctx.body = { errcode: 10000, result: [] };
58 58
     }
59 59
 
60 60
 }
@@ -69,8 +69,8 @@ export async function GetMPSDistrictPersonNum(ctx) {
69 69
     // if (param.DistrictID==16 )
70 70
     //     param.Year=ArrYear[1].Name;
71 71
 
72
-    let info=null;
73
-    if (param.DistrictID!="NaN"){
72
+    let info = null;
73
+    if (param.DistrictID != "NaN") {
74 74
 
75 75
         const url = "GetMPSDistrictPersonNum?DistrictID=" + param.DistrictID;
76 76
 
@@ -90,11 +90,11 @@ export async function GetMPSDistrictPersonNum(ctx) {
90 90
             //console.log(sql);
91 91
             const list = await commonModel.RunSql({}, sql);
92 92
             if (list && list.length > 0) {
93
-                for(let i=0;i<list.length;i++){
94
-                    list[i].PlanNum=Number(list[i].PlanNum);
93
+                for (let i = 0; i < list.length; i++) {
94
+                    list[i].PlanNum = Number(list[i].PlanNum);
95 95
                 }
96
-                
97
-                if (arr[1]){
96
+
97
+                if (arr[1]) {
98 98
                     arr.push({ "Name": "能上" + list[1].SchoolType2Short, "Year1": list[1].PlanNum, "Year2": list[1].PlanNum - list[0].PlanNum });
99 99
                     arr.push({ "Name": "能上" + list[5].SchoolType2Short, "Year1": list[5].PlanNum + list[3].PlanNum, "Year2": list[5].PlanNum + list[3].PlanNum - list[4].PlanNum - list[2].PlanNum });
100 100
                     arr.push({ "Name": "能上" + list[7].SchoolType2Short, "Year1": list[7].PlanNum, "Year2": list[7].PlanNum - list[6].PlanNum });
@@ -104,9 +104,9 @@ export async function GetMPSDistrictPersonNum(ctx) {
104 104
                     arr[1].Rate = Math.round(100 * arr[1].Year1 / arr[3].Year1);
105 105
                     arr[2].Rate = Math.round(100 * arr[2].Year1 / arr[3].Year1);
106 106
                 }
107
-                else{
107
+                else {
108 108
                     arr.push({ "Name": "能上" + list[1].SchoolType2Short, "Year1": list[1].PlanNum, "Year2": '-' });
109
-                    arr[0].Rate="-";
109
+                    arr[0].Rate = "-";
110 110
                 }
111 111
             }
112 112
 
@@ -152,20 +152,27 @@ export async function GetMPSCityPersonNum(ctx) {
152 152
 
153 153
         const sql2 = "select sum(PlanNum) as PlanNum from MPS_Score where ScoreYear='" + ArrYear[0].Name + "' and SchoolTarget in (1,2,3,4) and SchoolTargetRemark not in('4国际(本市)','5国际(非本市)');";
154 154
         const list2 = await commonModel.RunSql({}, sql2);
155
-        for(let i=0;i<list.length;i++){
156
-            list[i].PlanNum=Number(list[i].PlanNum);
155
+        for (let i = 0; i < list.length; i++) {
156
+            list[i].PlanNum = Number(list[i].PlanNum);
157 157
         }
158
-        list2[0].PlanNum=Number(list2[0].PlanNum);
158
+        list2[0].PlanNum = Number(list2[0].PlanNum);
159 159
         const arr = [];
160
-        arr.push({ "Name": "能上" + list[1].SchoolType2Short, "Year1": list[1].PlanNum, "Year2": list[1].PlanNum - list[0].PlanNum, "Other": "「四校」招生计划数 " + list2[0].PlanNum + "人" });
161
-        arr.push({ "Name": "能上" + list[5].SchoolType2Short, "Year1": list[5].PlanNum + list[3].PlanNum, "Year2": list[5].PlanNum + list[3].PlanNum - list[4].PlanNum - list[2].PlanNum, "Other": "特色高中招生计划数 " + list[3].PlanNum + "人" });
162
-        arr.push({ "Name": "能上" + list[7].SchoolType2Short, "Year1": list[7].PlanNum, "Year2": list[7].PlanNum - list[6].PlanNum });
163 160
 
164
-        arr.push({ "Name": "能上高中总计", "Year1": arr[0].Year1 + arr[1].Year1 + arr[2].Year1, "Year2": arr[0].Year2 + arr[1].Year2 + arr[2].Year2 });
161
+        if (arr[1]) {
162
+            arr.push({ "Name": "能上" + list[1].SchoolType2Short, "Year1": list[1].PlanNum, "Year2": list[1].PlanNum - list[0].PlanNum, "Other": "「四校」招生计划数 " + list2[0].PlanNum + "人" });
163
+            arr.push({ "Name": "能上" + list[5].SchoolType2Short, "Year1": list[5].PlanNum + list[3].PlanNum, "Year2": list[5].PlanNum + list[3].PlanNum - list[4].PlanNum - list[2].PlanNum, "Other": "特色高中招生计划数 " + list[3].PlanNum + "人" });
164
+            arr.push({ "Name": "能上" + list[7].SchoolType2Short, "Year1": list[7].PlanNum, "Year2": list[7].PlanNum - list[6].PlanNum });
165 165
 
166
-        arr[0].Rate = Math.round(100 * arr[0].Year1 / arr[3].Year1);
167
-        arr[1].Rate = Math.round(100 * arr[1].Year1 / arr[3].Year1);
168
-        arr[2].Rate = Math.round(100 * arr[2].Year1 / arr[3].Year1);
166
+            arr.push({ "Name": "能上高中总计", "Year1": arr[0].Year1 + arr[1].Year1 + arr[2].Year1, "Year2": arr[0].Year2 + arr[1].Year2 + arr[2].Year2 });
167
+
168
+            arr[0].Rate = Math.round(100 * arr[0].Year1 / arr[3].Year1);
169
+            arr[1].Rate = Math.round(100 * arr[1].Year1 / arr[3].Year1);
170
+            arr[2].Rate = Math.round(100 * arr[2].Year1 / arr[3].Year1);
171
+        }
172
+        else {
173
+            arr.push({ "Name": "能上" + list[1].SchoolType2Short, "Year1": list[1].PlanNum, "Year2": '-' });
174
+            arr[0].Rate = "-";
175
+        }
169 176
 
170 177
         info = {
171 178
             Year: param.Year,
@@ -195,14 +202,14 @@ export async function GetMPSScore(ctx) {
195 202
         DistrictID: ctx.query.DistrictID || 0,
196 203
     };
197 204
 
198
-    var url="GetMPSScore?ScoreYear="+param.ScoreYear+"&ScoreType="+param.ScoreType+"&DistrictID="+param.DistrictID;
205
+    var url = "GetMPSScore?ScoreYear=" + param.ScoreYear + "&ScoreType=" + param.ScoreType + "&DistrictID=" + param.DistrictID;
199 206
 
200 207
     var list = await BufferMemoryClass.get(url);
201 208
 
202 209
     if (process.env.NODE_ENV == 'development')
203
-        list=[];
210
+        list = [];
204 211
 
205
-    if (!list || list.length==0) {
212
+    if (!list || list.length == 0) {
206 213
 
207 214
         var sql0 = "SELECT f.ID,x.DistrictID as 'DistrictName',x.District as 'DistrictNameArea',f.DistrictID,f.ScoreType,f.SchoolOfGraduation,f.SchoolFullNameJunior,f.SchoolTarget,x.SchoolFullName,x.SchoolShortName,x.SchoolType2ShortID,x.SchoolType2Short,x.Accommodation,x.PublicOrPrivate,f.SchoolTargetRemark," +
208 215
             "f.PlanNum,f.ScoreTotal,f.Score1,f.Score2,f.Score3,f.Score4,f.SchoolTargetRemark2,f.PlanNumDifferenceValue,f.ScoreTotalDifferenceValue,x.PublicOrPrivate FROM MPS_Score f inner join MPS_School x on f.SchoolTarget=x.ID ";
@@ -347,29 +354,29 @@ export async function GetMPSScore(ctx) {
347 354
             }
348 355
         }
349 356
 
350
-        var today=moment().format("MM-DD");
351
-        var year=moment().format("YYYY");
352
-        if (ArrYear[0].IsNullScoreLine && param.ScoreYear==year){
353
-            sql=sql.replace(ArrYear[0].Name,ArrYear[1].Name);
357
+        var today = moment().format("MM-DD");
358
+        var year = moment().format("YYYY");
359
+        if (ArrYear[0].IsNullScoreLine && param.ScoreYear == year) {
360
+            sql = sql.replace(ArrYear[0].Name, ArrYear[1].Name);
354 361
 
355 362
             var list2 = await commonModel.RunSql({}, sql);
356
-            for(var i=0;i<list.length;i++){
357
-                for(var j=0;j<list2.length;j++){
358
-                    if (list[i].DistrictID==list2[j].DistrictID
359
-                        && list[i].SchoolTarget==list2[j].SchoolTarget
360
-                        && (!list[i].SchoolOfGraduation || (list[i].SchoolOfGraduation && list[i].SchoolOfGraduation==list2[j].SchoolOfGraduation))){
361
-                        list[i].ScoreTotal=list2[j].ScoreTotal;
362
-                        list[i].Score1=list2[j].Score1;
363
-                        list[i].Score2=list2[j].Score2;
364
-                        list[i].Score3=list2[j].Score3;
365
-                        list[i].Score4=list2[j].Score4;
366
-                        list[i].ScoreTotalDifferenceValue=list2[j].ScoreTotalDifferenceValue;
363
+            for (var i = 0; i < list.length; i++) {
364
+                for (var j = 0; j < list2.length; j++) {
365
+                    if (list[i].DistrictID == list2[j].DistrictID
366
+                        && list[i].SchoolTarget == list2[j].SchoolTarget
367
+                        && (!list[i].SchoolOfGraduation || (list[i].SchoolOfGraduation && list[i].SchoolOfGraduation == list2[j].SchoolOfGraduation))) {
368
+                        list[i].ScoreTotal = list2[j].ScoreTotal;
369
+                        list[i].Score1 = list2[j].Score1;
370
+                        list[i].Score2 = list2[j].Score2;
371
+                        list[i].Score3 = list2[j].Score3;
372
+                        list[i].Score4 = list2[j].Score4;
373
+                        list[i].ScoreTotalDifferenceValue = list2[j].ScoreTotalDifferenceValue;
367 374
 
368 375
                         break;
369 376
                     }
370 377
                 }
371 378
 
372
-                if (list[i].DistrictID=="12" && param.ScoreType=="名额到校") {
379
+                if (list[i].DistrictID == "12" && param.ScoreType == "名额到校") {
373 380
                     if (list[i].SchoolTarget <= "5") {
374 381
                         list[i].ID = "0";
375 382
                         list[i].SchoolTarget = "0";
@@ -379,9 +386,9 @@ export async function GetMPSScore(ctx) {
379 386
                 }
380 387
             }
381 388
 
382
-            if (param.ScoreType=="名额到区")
383
-                list=_.orderBy(list, ['DistrictID','ScoreTotal'], ['asc','desc']);
384
-            else if (param.ScoreType=="名额到校") {
389
+            if (param.ScoreType == "名额到区")
390
+                list = _.orderBy(list, ['DistrictID', 'ScoreTotal'], ['asc', 'desc']);
391
+            else if (param.ScoreType == "名额到校") {
385 392
                 list = _.orderBy(list, ['DistrictID', 'SchoolOfGraduation', 'ScoreTotal'], ['asc', 'asc', 'desc']);
386 393
                 for (var i = 0; i < list.length; i++) {
387 394
                     var item = list[i];
@@ -397,7 +404,7 @@ export async function GetMPSScore(ctx) {
397 404
                     item.Name = item.SchoolShortName;
398 405
                 }
399 406
             }
400
-            else if (param.ScoreType=="1-15志愿") {
407
+            else if (param.ScoreType == "1-15志愿") {
401 408
                 list = _.orderBy(list, ['DistrictID', "SchoolType2ShortID", 'ScoreTotal'], ['asc', 'asc', 'desc']);
402 409
                 for (var i = 0; i < list.length; i++) {
403 410
                     var item = list[i];
@@ -407,8 +414,8 @@ export async function GetMPSScore(ctx) {
407 414
                     if (i > 0) {
408 415
                         item.SchoolType2ShortIDTemp = list[i - 1].SchoolType2ShortID;
409 416
                     }
410
-                    else{
411
-                        item.SchoolType2ShortIDTemp="";
417
+                    else {
418
+                        item.SchoolType2ShortIDTemp = "";
412 419
                     }
413 420
 
414 421
                     item.Name = item.SchoolShortName;
@@ -416,27 +423,27 @@ export async function GetMPSScore(ctx) {
416 423
             }
417 424
         }
418 425
 
419
-        for(let i=0;i<list.length;i++){
420
-            let item=list[i];
421
-            item.Score1=stringUtils.TrimEndZero(item.Score1);
422
-            item.Score2=stringUtils.TrimEndZero(item.Score2);
423
-            item.Score3=stringUtils.TrimEndZero(item.Score3);
424
-            item.Score4=stringUtils.TrimEndZero(item.Score4);
425
-            item.ScoreTotal=stringUtils.TrimEndZero(item.ScoreTotal);
426
-            item.ScoreTotalDifferenceValue=stringUtils.TrimEndZero(item.ScoreTotalDifferenceValue); 
426
+        for (let i = 0; i < list.length; i++) {
427
+            let item = list[i];
428
+            item.Score1 = stringUtils.TrimEndZero(item.Score1);
429
+            item.Score2 = stringUtils.TrimEndZero(item.Score2);
430
+            item.Score3 = stringUtils.TrimEndZero(item.Score3);
431
+            item.Score4 = stringUtils.TrimEndZero(item.Score4);
432
+            item.ScoreTotal = stringUtils.TrimEndZero(item.ScoreTotal);
433
+            item.ScoreTotalDifferenceValue = stringUtils.TrimEndZero(item.ScoreTotalDifferenceValue);
427 434
         }
428 435
 
429
-        let obj1={};
430
-        obj1.KeyName=url;
431
-        obj1.ValueString=JSON.stringify(list);
436
+        let obj1 = {};
437
+        obj1.KeyName = url;
438
+        obj1.ValueString = JSON.stringify(list);
432 439
         await BufferMemoryClass.add(obj1);
433 440
     }
434
-    else{
435
-        list=list[0].ValueString;
436
-        list=JSON.parse(list);
441
+    else {
442
+        list = list[0].ValueString;
443
+        list = JSON.parse(list);
437 444
     }
438 445
 
439
-    ctx.body = {"errcode": 10000,result:list};
446
+    ctx.body = { "errcode": 10000, result: list };
440 447
 }
441 448
 
442 449
 //得到收藏学校分数线(小程序使用)
@@ -447,76 +454,76 @@ export async function GetMPSScoreByCollect(ctx) {
447 454
         DistrictID: ctx.query.DistrictID || 0,
448 455
         SchoolType1: ctx.query.SchoolType1 || '高中',
449 456
     };
450
-    var sql="";
451
-    if (param.SchoolType1=='高中'){
452
-        sql="select x.ID,f.ScoreType,f.PlanNum,f.ScoreTotal,f.Score1,f.Score2,f.Score3,f.Score4,f.PlanNumDifferenceValue,f.ScoreTotalDifferenceValue,f.DistrictID,f.SchoolTarget,f.SchoolOfGraduation " +
457
+    var sql = "";
458
+    if (param.SchoolType1 == '高中') {
459
+        sql = "select x.ID,f.ScoreType,f.PlanNum,f.ScoreTotal,f.Score1,f.Score2,f.Score3,f.Score4,f.PlanNumDifferenceValue,f.ScoreTotalDifferenceValue,f.DistrictID,f.SchoolTarget,f.SchoolOfGraduation " +
453 460
             "from MPS_Score f inner join MPS_School x on f.SchoolTarget=x.ID inner join MPS_UserCollect uc on x.ID=uc.SchoolID " +
454
-            "where f.ScoreYear='"+param.ScoreYear+"' and uc.UserID="+param.UserID+" and (f.PlanNum>0 or f.PlanNum=-999) " +
455
-            "and ((f.ScoreType in ('名额到区','1-15志愿') and f.DistrictID="+param.DistrictID+") or (f.ScoreType in ('自主招生') and f.SchoolTargetRemark='1学科')) " +
461
+            "where f.ScoreYear='" + param.ScoreYear + "' and uc.UserID=" + param.UserID + " and (f.PlanNum>0 or f.PlanNum=-999) " +
462
+            "and ((f.ScoreType in ('名额到区','1-15志愿') and f.DistrictID=" + param.DistrictID + ") or (f.ScoreType in ('自主招生') and f.SchoolTargetRemark='1学科')) " +
456 463
             "order by SchoolTarget,f.ScoreType desc,SchoolTargetRemark;";
457 464
     }
458
-    else{
459
-        sql="select f.SchoolOfGraduation as 'ID',f.SchoolFullNameJunior as 'SchoolFullName',f.DistrictID,x.SchoolShortName,f.PlanNum,f.ScoreTotal,f.Score1,f.Score2,f.Score3,f.Score4,f.PlanNumDifferenceValue,f.ScoreTotalDifferenceValue " +
465
+    else {
466
+        sql = "select f.SchoolOfGraduation as 'ID',f.SchoolFullNameJunior as 'SchoolFullName',f.DistrictID,x.SchoolShortName,f.PlanNum,f.ScoreTotal,f.Score1,f.Score2,f.Score3,f.Score4,f.PlanNumDifferenceValue,f.ScoreTotalDifferenceValue " +
460 467
             "from MPS_Score f inner join MPS_School x on f.SchoolTarget=x.ID " +
461 468
             "inner join MPS_UserCollect uc on f.SchoolOfGraduation=uc.SchoolID " +
462
-            "where f.ScoreYear='"+param.ScoreYear+"' and uc.UserID="+param.UserID+" " +
469
+            "where f.ScoreYear='" + param.ScoreYear + "' and uc.UserID=" + param.UserID + " " +
463 470
             "and f.ScoreType in ('名额到校') and (f.PlanNum>0 or f.PlanNum=-999) " +
464 471
             "order by SchoolOfGraduation;";
465 472
     }
466 473
 
467
-    var list=await commonModel.RunSql({},sql);
474
+    var list = await commonModel.RunSql({}, sql);
468 475
 
469 476
     for (var i = 0; i < list.length; i++) {
470 477
         var item = list[i];
471
-        if (param.SchoolType1=='高中') {
478
+        if (param.SchoolType1 == '高中') {
472 479
             item.Name = item.ScoreType;
473 480
             delete item.ScoreType;
474 481
         }
475 482
         else {
476 483
             item.Name = item.SchoolShortName;
477
-            item.District=getDistrict(item.DistrictID);
484
+            item.District = getDistrict(item.DistrictID);
478 485
         }
479 486
 
480
-        item.Height=93;
487
+        item.Height = 93;
481 488
 
482 489
         if (!item.ScoreTotal)
483
-            item.ScoreTotal="";
490
+            item.ScoreTotal = "";
484 491
         if (!item.Score1)
485
-            item.Score1="";
492
+            item.Score1 = "";
486 493
         if (!item.Score2)
487
-            item.Score2="";
494
+            item.Score2 = "";
488 495
         if (!item.Score3)
489
-            item.Score3="";
496
+            item.Score3 = "";
490 497
         if (!item.Score4)
491
-            item.Score4="";
498
+            item.Score4 = "";
492 499
 
493 500
         if (i > 0) {
494 501
             item.TempID = list[i - 1].ID;
495 502
         }
496 503
 
497
-        item.Score1=stringUtils.TrimEndZero(item.Score1);
498
-        item.Score2=stringUtils.TrimEndZero(item.Score2);
499
-        item.Score3=stringUtils.TrimEndZero(item.Score3);
500
-        item.Score4=stringUtils.TrimEndZero(item.Score4);
501
-        item.ScoreTotal=stringUtils.TrimEndZero(item.ScoreTotal);
502
-        item.ScoreTotalDifferenceValue=stringUtils.TrimEndZero(item.ScoreTotalDifferenceValue); 
503
-            
504
+        item.Score1 = stringUtils.TrimEndZero(item.Score1);
505
+        item.Score2 = stringUtils.TrimEndZero(item.Score2);
506
+        item.Score3 = stringUtils.TrimEndZero(item.Score3);
507
+        item.Score4 = stringUtils.TrimEndZero(item.Score4);
508
+        item.ScoreTotal = stringUtils.TrimEndZero(item.ScoreTotal);
509
+        item.ScoreTotalDifferenceValue = stringUtils.TrimEndZero(item.ScoreTotalDifferenceValue);
510
+
504 511
     }
505 512
 
506
-    var year=moment().format("YYYY");
507
-    if (ArrYear[0].IsNullScoreLine && param.ScoreYear==year){
508
-        sql=sql.replace(ArrYear[0].Name,ArrYear[1].Name);
513
+    var year = moment().format("YYYY");
514
+    if (ArrYear[0].IsNullScoreLine && param.ScoreYear == year) {
515
+        sql = sql.replace(ArrYear[0].Name, ArrYear[1].Name);
509 516
 
510 517
         var list2 = await commonModel.RunSql({}, sql);
511
-        for(var i=0;i<list.length;i++){
512
-            if (list[i].Name!="自主招生") {
518
+        for (var i = 0; i < list.length; i++) {
519
+            if (list[i].Name != "自主招生") {
513 520
                 for (var j = 0; j < list2.length; j++) {
514
-                    var item=list[i];
515
-                    if (param.SchoolType1=='高中') {
521
+                    var item = list[i];
522
+                    if (param.SchoolType1 == '高中') {
516 523
                         if (item.DistrictID == list2[j].DistrictID
517 524
                             && item.Name == list2[j].ScoreType
518 525
                             && item.SchoolTarget == list2[j].SchoolTarget
519
-                            && list2[j].ScoreTotal>0
526
+                            && list2[j].ScoreTotal > 0
520 527
                             && item.ID == list2[j].ID) {
521 528
                             item.ScoreTotal = stringUtils.TrimEndZero(list2[j].ScoreTotal);
522 529
                             item.Score1 = stringUtils.TrimEndZero(list2[j].Score1);
@@ -524,14 +531,14 @@ export async function GetMPSScoreByCollect(ctx) {
524 531
                             item.Score3 = stringUtils.TrimEndZero(list2[j].Score3);
525 532
                             item.Score4 = stringUtils.TrimEndZero(list2[j].Score4);
526 533
                             item.ScoreTotalDifferenceValue = stringUtils.TrimEndZero(list2[j].ScoreTotalDifferenceValue);
527
-                            
534
+
528 535
                             break;
529 536
                         }
530 537
                     }
531 538
                     else {
532 539
                         if (item.DistrictID == list2[j].DistrictID
533 540
                             && item.Name == list2[j].SchoolShortName
534
-                            && list2[j].ScoreTotal>0
541
+                            && list2[j].ScoreTotal > 0
535 542
                             && item.ID == list2[j].ID) {
536 543
                             item.ScoreTotal = stringUtils.TrimEndZero(list2[j].ScoreTotal);
537 544
                             item.Score1 = stringUtils.TrimEndZero(list2[j].Score1);
@@ -547,48 +554,48 @@ export async function GetMPSScoreByCollect(ctx) {
547 554
         }
548 555
     }
549 556
 
550
-    ctx.body = {"errcode": 10000,result:list};
557
+    ctx.body = { "errcode": 10000, result: list };
551 558
 }
552 559
 
553 560
 //修改分数线
554 561
 export async function UpdateMPSScore(ctx) {
555 562
     let param = ctx.request.body;
556
-    let sql="update MPS_Score set ? where ID="+param.ID+";";
563
+    let sql = "update MPS_Score set ? where ID=" + param.ID + ";";
557 564
 
558
-    if (param.ID==0){
559
-        let sql2 = "select * from MPS_Score where ScoreType='"+param.ScoreType+"' and ScoreYear='"+param.ScoreYear+"'";
560
-        sql2+=" and DistrictID="+param.DistrictID+" ";
565
+    if (param.ID == 0) {
566
+        let sql2 = "select * from MPS_Score where ScoreType='" + param.ScoreType + "' and ScoreYear='" + param.ScoreYear + "'";
567
+        sql2 += " and DistrictID=" + param.DistrictID + " ";
561 568
         if (!param.SchoolOfGraduation)
562
-            param.SchoolOfGraduation=0;
563
-        sql2+=" and SchoolOfGraduation='"+param.SchoolOfGraduation+"' ";
564
-        sql2+=" and SchoolTarget='"+param.SchoolTarget+"'";
565
-        if (param.SchoolTargetRemark && param.SchoolTargetRemark!="undefined") {
569
+            param.SchoolOfGraduation = 0;
570
+        sql2 += " and SchoolOfGraduation='" + param.SchoolOfGraduation + "' ";
571
+        sql2 += " and SchoolTarget='" + param.SchoolTarget + "'";
572
+        if (param.SchoolTargetRemark && param.SchoolTargetRemark != "undefined") {
566 573
             sql2 += " and SchoolTargetRemark='" + param.SchoolTargetRemark + "';";
567 574
         }
568 575
 
569
-        let hasID=await commonModel.RunSql({},sql2);
570
-        if (hasID && hasID.length>0) {
571
-            param.ID=hasID[0].ID;
572
-            sql="update MPS_Score set ? where ID="+param.ID+";";
576
+        let hasID = await commonModel.RunSql({}, sql2);
577
+        if (hasID && hasID.length > 0) {
578
+            param.ID = hasID[0].ID;
579
+            sql = "update MPS_Score set ? where ID=" + param.ID + ";";
573 580
         }
574
-        else{
581
+        else {
575 582
             delete param.ID;
576 583
             sql = "insert into MPS_Score SET ?";
577 584
         }
578 585
     }
579 586
 
580
-    let insertID = await commonModel.RunSql(param,sql);
587
+    let insertID = await commonModel.RunSql(param, sql);
581 588
 
582
-    if (!param.ID || param.ID==0){
583
-        sql="update MPS_Score f,MPS_School x set f.SchoolFullName=x.SchoolFullName where f.SchoolTarget=x.ID;";
584
-        await commonModel.RunSql({},sql);
585
-        sql="update MPS_Score f,MPS_School x set f.SchoolFullNameJunior=x.SchoolFullName where f.SchoolOfGraduation=x.ID;";
586
-        await commonModel.RunSql({},sql);
589
+    if (!param.ID || param.ID == 0) {
590
+        sql = "update MPS_Score f,MPS_School x set f.SchoolFullName=x.SchoolFullName where f.SchoolTarget=x.ID;";
591
+        await commonModel.RunSql({}, sql);
592
+        sql = "update MPS_Score f,MPS_School x set f.SchoolFullNameJunior=x.SchoolFullName where f.SchoolOfGraduation=x.ID;";
593
+        await commonModel.RunSql({}, sql);
587 594
 
588
-        param.ID=insertID.insertId;
595
+        param.ID = insertID.insertId;
589 596
     }
590 597
 
591
-    ctx.body = {"errcode": 10000,result:param.ID};
598
+    ctx.body = { "errcode": 10000, result: param.ID };
592 599
 }
593 600
 
594 601
 // 得到分数线(Web使用)