Browse Source

增强代码健壮性

Pchen. 9 months ago
parent
commit
9db0c06ff2
2 changed files with 6 additions and 6 deletions
  1. 1 1
      apis/Lepao/Path/GetPathList.js
  2. 5 5
      apis/Lepao/Record/GetRecordDetail.js

+ 1 - 1
apis/Lepao/Path/GetPathList.js

@@ -20,7 +20,7 @@ class GetPathList extends API {
             })
 
         // 校验分页参数
-        if (isNaN(pagesize) || pagesize <= 0) {
+        if (isNaN(pagesize) || pagesize <= 0 || pagesize > 50) {
             return res.json({
                 ...BaseStdResponse.ERR,
                 msg: '参数错误'

+ 5 - 5
apis/Lepao/Record/GetRecordDetail.js

@@ -3,11 +3,11 @@ const db = require("../../../plugin/DataBase/db")
 const AccessControl = require("../../../lib/AccessControl")
 const { BaseStdResponse } = require("../../../BaseStdResponse")
 
-class GetPathDetail extends API {
+class GetRecordDetail extends API {
     constructor() {
         super();
 
-        this.setPath('/Lepao/GetPathDetail')
+        this.setPath('/Lepao/GetRecordDetail')
         this.setMethod('GET')
     }
 
@@ -47,9 +47,9 @@ class GetPathDetail extends API {
                 ON 
                     r.path_id = p.id
                 WHERE 
-                    a.create_user = ?
+                    a.create_user = ? AND r.id = ?
             `
-        let rows = await db.query(sql, [id])
+        let rows = await db.query(sql, [uuid, id])
 
         if (!rows)
             return res.json({
@@ -73,4 +73,4 @@ class GetPathDetail extends API {
     }
 }
 
-module.exports.GetPathDetail = GetPathDetail
+module.exports.GetRecordDetail = GetRecordDetail