chengjie před 3 týdny
rodič
revize
bf86d481ec

+ 3 - 2
src/api/mathcalculate/mathController.js

@@ -12,6 +12,7 @@ import constantClass from '../../util/constant/index.js';
12 12
 import fs from 'fs';
13 13
 import { promises as fsPromises } from 'fs';
14 14
 import COS from 'cos-nodejs-sdk-v5';
15
+import { computeMath } from '../questionTypes/questionTypesController.js';
15 16
 
16 17
 export async function MathLogin(ctx) {
17 18
     let param = ctx.request.body;
@@ -671,7 +672,7 @@ function getQuestionTypeInfo(item) {
671 672
     }
672 673
     //得到随机数
673 674
     function getNumber(arr) {
674
-        let rnd = common.random(0, arr.length - 1);
675
+        let rnd = stringUtils.Random(0, arr.length - 1);
675 676
         return arr[rnd];
676 677
     }
677 678
 
@@ -713,4 +714,4 @@ function getQuestionTypeInfo(item) {
713 714
 
714 715
         return result;
715 716
     }
716
-}
717
+}

+ 2 - 1
src/api/mps/mpsCommonController.js

@@ -9,6 +9,7 @@ import _ from 'lodash';
9 9
 import axios from 'axios';
10 10
 import { stringUtils } from '../../util/stringClass.js';
11 11
 import { Encrypt, Decrypt } from '../../util/crypto/index.js';
12
+import WXBizDataCrypt from '../../util/WXBizDataCrypt.js';
12 13
 
13 14
 /**
14 15
  * 分数线网页首页
@@ -1598,4 +1599,4 @@ function buildWish(item, wishType) {
1598 1599
 
1599 1600
 export async function Ping(ctx) {
1600 1601
     ctx.body = { errcode: 10000 };
1601
-}
1602
+}

+ 2 - 1
src/api/pinyin/pinyinController.js

@@ -8,6 +8,7 @@ import { Encrypt, Decrypt } from '../../util/crypto/index.js';
8 8
 import { stringUtils } from '../../util/stringClass.js';
9 9
 import WXBizDataCrypt from '../../util/WXBizDataCrypt.js';
10 10
 import { globalCache } from '../../util/GlobalCache.js';
11
+import constantClass from '../../util/constant/index.js';
11 12
 
12 13
 export async function PinyinLogin(ctx) {
13 14
     let param = ctx.request.body;
@@ -481,4 +482,4 @@ export async function GetPinyinUnitWords(ctx) {
481 482
     }
482 483
 
483 484
     ctx.body = {"errcode": 10000, result: result};
484
-}
485
+}

+ 1 - 1
src/api/questionTypes/questionTypesController.js

@@ -606,7 +606,7 @@ export async function MakeQuestionTypeWXACode(ctx) {
606 606
     ctx.body = { errcode: 10000, result: 0 };
607 607
 }
608 608
 
609
-function computeMath(questionType) {
609
+export function computeMath(questionType) {
610 610
     var result;
611 611
     switch (questionType.OperateAB) {
612 612
         case "+":

+ 2 - 2
src/api/score/scoreController.js

@@ -392,7 +392,7 @@ export async function AddScore2(ctx) {
392 392
         }
393 393
     }
394 394
     if (!RankList) RankList = [];
395
-    ctx.body = { errcode: 10000, result: { Points: points, CurrentRank, HistoryRank: historyRank, MinDuration, PracticeNumber: practiceNumber, IsScoreRecord, IsTimeRecord, MakeProgress: makeProgress, RankList, ScoreID: scoreInfo.insertId } };
395
+    ctx.body = { errcode: 10000, result: { Points: points, CurrentRank, HistoryRank: historyRank, MinDuration, PracticeNumber: practiceNumber, IsScoreRecord: isScoreRecord, IsTimeRecord: isTimeRecord, MakeProgress: makeProgress, RankList, ScoreID: scoreInfo.insertId } };
396 396
 }
397 397
 
398 398
 export async function AddScore2Intensify(ctx) {
@@ -591,7 +591,7 @@ export async function AddScore3(ctx) {
591 591
     }
592 592
     if (!RankList) RankList = [];
593 593
     if (MinDuration == 999999) MinDuration = param.Duration;
594
-    ctx.body = { errcode: 10000, result: { Points: points, CurrentRank, MinDuration, PracticeNumber: practiceNumber, IsScoreRecord, IsTimeRecord, RankList, PersonNumber24Hours, CurrentRankRate, GoldCoinAll, MaxPoints, PointTotal, SpeedLevel, IsPointLevel, IsSpeedLevel, ScoreID: scoreResult.insertId } };
594
+    ctx.body = { errcode: 10000, result: { Points: points, CurrentRank, MinDuration, PracticeNumber: practiceNumber, IsScoreRecord: isScoreRecord, IsTimeRecord: isTimeRecord, RankList, PersonNumber24Hours, CurrentRankRate, GoldCoinAll, MaxPoints, PointTotal, SpeedLevel, IsPointLevel: isPointLevel, IsSpeedLevel: isSpeedLevel, ScoreID: scoreResult.insertId } };
595 595
 }
596 596
 
597 597
 export async function AddScore3Intensify(ctx) {

+ 2 - 1
src/api/users/userAllController.js

@@ -269,8 +269,9 @@ export async function SendRemind(ctx) {
269 269
   }
270 270
 
271 271
   let result;
272
+  let token;
272 273
   try {
273
-    const token = await getWxAccessToken(appid, appsecret);
274
+    token = await getWxAccessToken(appid, appsecret);
274 275
     result = { errcode: 10000 };
275 276
   } catch (err) {
276 277
     result = { errcode: 101, errStr: err.message };

+ 2 - 2
src/model/yjbdc.js

@@ -120,7 +120,7 @@ class YJBDC {
120 120
             const sql = "INSERT INTO YJBDC_OCRs SET ?";
121 121
             return await query(sql, [obj]);
122 122
         } catch (error) {
123
-            onsole.error('添加OCR失败:', error);
123
+            console.error('添加OCR失败:', error);
124 124
             throw error;
125 125
         }
126 126
     }
@@ -203,4 +203,4 @@ class YJBDC {
203 203
 
204 204
 }
205 205
 
206
-export default YJBDC;
206
+export default YJBDC;

+ 3 - 2
src/util/WXBizDataCrypt.js

@@ -16,12 +16,13 @@ class WXBizDataCrypt {
16 16
     encryptedData = Buffer.from(encryptedData, 'base64');
17 17
     iv = Buffer.from(iv, 'base64');
18 18
 
19
+    let decoded;
19 20
     try {
20 21
       // 解密
21 22
       const decipher = crypto.createDecipheriv('aes-128-cbc', sessionKey, iv);
22 23
       // 设置自动 padding 为 true,删除填充补位
23 24
       decipher.setAutoPadding(true);
24
-      let decoded = decipher.update(encryptedData, 'binary', 'utf8');
25
+      decoded = decipher.update(encryptedData, 'binary', 'utf8');
25 26
       decoded += decipher.final('utf8');
26 27
       
27 28
       decoded = JSON.parse(decoded);
@@ -38,4 +39,4 @@ class WXBizDataCrypt {
38 39
   }
39 40
 }
40 41
 
41
-export default WXBizDataCrypt;
42
+export default WXBizDataCrypt;

+ 1 - 0
src/util/constant/index.js

@@ -3644,6 +3644,7 @@ export default {
3644 3644
         return List;
3645 3645
     },
3646 3646
     getEnglishLetter: function (letter) {
3647
+        const word = String(letter || "").toUpperCase();
3647 3648
         switch (letter) {
3648 3649
             case "A":
3649 3650
             case "a":