|
@@ -36,7 +36,7 @@ ProjectsDAO.prototype.getUserProject = function (userId, ProjId, callback) {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-ProjectsDAO.prototype.updateUserProjects = function(userId, datas, callback){
|
|
|
+ProjectsDAO.prototype.updateUserProjects = async function(userId, datas, callback){
|
|
|
let data, project, updateLength = 0, hasError = false, deleteInfo = null, i, newProject;
|
|
|
let updateAll = function (err) {
|
|
|
if (!err){
|
|
@@ -61,7 +61,7 @@ ProjectsDAO.prototype.updateUserProjects = function(userId, datas, callback){
|
|
|
data.updateData['createDateTime'] = new Date();
|
|
|
newProject = new Projects(data.updateData);
|
|
|
// 查找同级是否存在同名数据
|
|
|
- let exist = this.isExist(data.updateData.name, data.updateData.ParentID);
|
|
|
+ let exist = await this.isExist(data.updateData.name, data.updateData.ParentID);
|
|
|
if (exist) {
|
|
|
callback(1, '同级目录已存在相同名称数据.', null);
|
|
|
return;
|
|
@@ -191,10 +191,9 @@ ProjectsDAO.prototype.getProjectProperty = async function(id) {
|
|
|
*/
|
|
|
ProjectsDAO.prototype.isExist = async function(name, parentID) {
|
|
|
parentID = parseInt(parentID);
|
|
|
- if (name === '' || isNaN(parentID) || parentID <= 0) {
|
|
|
+ if (name === '' || isNaN(parentID)) {
|
|
|
return true;
|
|
|
}
|
|
|
-
|
|
|
let count = await Projects.count({ParentID: parentID, name: name});
|
|
|
|
|
|
return count > 0;
|