소스 검색

回收站恢复bug

zhongzewei 6 년 전
부모
커밋
021c02cd79
2개의 변경된 파일7개의 추가작업 그리고 6개의 파일을 삭제
  1. 3 2
      modules/pm/controllers/pm_controller.js
  2. 4 4
      modules/pm/models/project_model.js

+ 3 - 2
modules/pm/controllers/pm_controller.js

@@ -451,10 +451,11 @@ module.exports = {
     },
 
     recGC: function(request, response){
-        let userID = request.session.sessionUser.id;
+        let userID = request.session.sessionUser.id,
+            compilationId = request.session.sessionCompilation._id;
         let data = JSON.parse(request.body.data);
         let nodes = data.nodes;
-        ProjectsData.recGC(userID, nodes, function (err, msg, data) {
+        ProjectsData.recGC(userID, compilationId, nodes, function (err, msg, data) {
             callback(request, response, err, msg, data);
         });
    },

+ 4 - 4
modules/pm/models/project_model.js

@@ -467,8 +467,8 @@ ProjectsDAO.prototype.getGCFiles = async function (fileType, userID) {
     return rst;
 };
 
-ProjectsDAO.prototype.getFirstNodeID = async function (userID, pid) {
-    let nodes = await Projects.find({userID: userID, ParentID: pid, deleteInfo: null});
+ProjectsDAO.prototype.getFirstNodeID = async function (userID, compilationId, pid) {
+    let nodes = await Projects.find({userID: userID, compilation: compilationId, ParentID: pid, deleteInfo: null});
     if (nodes.length === 0) {
         return -1;
     }
@@ -499,7 +499,7 @@ ProjectsDAO.prototype.getFirstNodeID = async function (userID, pid) {
     }
 };
 
-ProjectsDAO.prototype.recGC = async function (userID, datas, callback) {
+ProjectsDAO.prototype.recGC = async function (userID, compilationId, datas, callback) {
     let functions = [];
     let updateDatas = [];
     for (let i = 0, len = datas.length; i < len; i++) {
@@ -521,7 +521,7 @@ ProjectsDAO.prototype.recGC = async function (userID, datas, callback) {
                         datas[i].updateData.ParentID = -1;
                     }
                 }
-                let firstNodeID = await this.getFirstNodeID(userID, projPid);
+                let firstNodeID = await this.getFirstNodeID(userID, compilationId, projPid);
                 datas[i].updateData.NextSiblingID = firstNodeID;
             }
             updateDatas.push(datas[i])