Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pisns-forum-api
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
scrmGroup
pisns-forum-api
Commits
22adf15b
Commit
22adf15b
authored
Jul 17, 2015
by
陈家荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
111
parent
ffa6bd1a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
90 additions
and
93 deletions
+90
-93
forumThread.js
app/controllers/admin/forumThread.js
+90
-93
No files found.
app/controllers/admin/forumThread.js
View file @
22adf15b
...
@@ -675,102 +675,99 @@ var getClientIP = function(req) {
...
@@ -675,102 +675,99 @@ var getClientIP = function(req) {
//给以前的已一级评论添加楼层
//给以前的已一级评论添加楼层
router
.
get
(
'/thread/updateConmentFloor'
,
function
(
req
,
res
,
next
)
{
router
.
get
(
'/thread/updateConmentFloor'
,
function
(
req
,
res
,
next
)
{
var
ent_code
=
req
.
session
.
user
.
ent_code
;
res
.
json
(
returnCode
.
SUCCESS
);
// var ent_code = req.params.ent_code || null;
var
conditions
=
{
if
(
ent_code
){
// ent_code: ent_code
var
conditions
=
{
};
ent_code
:
ent_code
async
.
waterfall
([
};
function
(
callback
)
{
// 查找文章的总数
async
.
waterfall
([
forumThreadService
.
getAllCountByFid
(
conditions
,
function
(
err
,
count
){
function
(
callback
)
{
// 查找文章的总数
if
(
err
){
forumThreadService
.
getAllCountByFid
(
conditions
,
function
(
err
,
count
){
callback
(
err
,
null
);
if
(
err
){
}
else
{
callback
(
err
,
null
);
callback
(
null
,
count
);
}
else
{
}
callback
(
null
,
count
);
});
}
},
});
function
(
count
,
callback
)
{
//查找所有文章
},
forumThreadService
.
getAllThreadByFidNoLimit
(
conditions
,
1
,
count
,
null
,
function
(
err
,
datas
){
function
(
count
,
callback
)
{
//查找所有文章
if
(
err
){
forumThreadService
.
getAllThreadByFidNoLimit
(
conditions
,
1
,
count
,
null
,
function
(
err
,
datas
){
callback
(
err
,
null
);
if
(
err
){
}
else
{
callback
(
err
,
null
);
callback
(
null
,
datas
);
}
else
{
}
callback
(
null
,
datas
);
});
}
}
});
],
function
(
err
,
result
)
{
}
var
asyncTasks
=
[];
],
function
(
err
,
result
)
{
result
.
items
.
forEach
(
function
(
doc
,
t
)
{
//遍历文章
var
asyncTasks
=
[];
asyncTasks
.
push
(
function
(
callback2
)
{
result
.
items
.
forEach
(
function
(
doc
)
{
//遍历文章
//获取文章所有一级评论
asyncTasks
.
push
(
function
(
callback2
)
{
var
conditions
=
{
//获取文章所有一级评论,倒数排列
thread
:
doc
.
_id
,
var
conditions
=
{
level
:
'1'
thread
:
doc
.
_id
,
};
level
:
'1'
async
.
waterfall
([
};
function
(
callback
)
{
async
.
waterfall
([
//统计评论数
function
(
callback
)
{
forumCommentService
.
count
(
conditions
,
function
(
err
,
count
)
{
//获取所有评论
if
(
err
)
{
forumCommentService
.
count
(
conditions
,
function
(
err
,
count
)
{
console
.
log
(
err
);
if
(
err
)
{
callback
(
err
,
null
);
console
.
log
(
err
);
}
else
{
callback
(
err
,
null
);
callback
(
null
,
count
);
}
else
{
callback
(
null
,
count
);
}
});
},
function
(
count
,
callback
)
{
//获取所有评论
forumCommentService
.
getAllComment
(
conditions
,
1
,
count
,
function
(
err
,
results
)
{
if
(
err
)
{
console
.
log
(
err
);
callback
(
err
,
null
);
}
else
{
callback
(
null
,
results
.
items
);
}
});
},
function
(
comments
,
callback
)
{
comments
=
_
.
sortBy
(
comments
,
function
(
comment
){
return
comment
.
created
;
});
if
(
comments
.
length
>
0
){
// 给每一个评论添加楼层
comments
.
forEach
(
function
(
comment
,
i
){
forumCommentService
.
updateCommentFloorById
(
comment
.
_id
,
i
+
1
,
function
(
err
,
docc
){
if
(
err
)
{
console
.
error
(
err
);
// callback(err,null);
}
else
{
// callback(null,null);
}
})
});
}
}
});
},
function
(
count
,
callback
)
{
//获取所有评论
forumCommentService
.
getAllComment
(
conditions
,
1
,
count
,
function
(
err
,
results
)
{
if
(
err
)
{
console
.
log
(
err
);
callback
(
err
,
null
);
}
else
{
callback
(
null
,
results
.
items
);
}
});
},
function
(
comments
,
callback
)
{
comments
=
_
.
sortBy
(
comments
,
function
(
comment
){
return
comment
.
created
;
});
if
(
comments
.
length
>
0
){
// 给每一个评论添加楼层
comments
.
forEach
(
function
(
comment
,
i
){
forumCommentService
.
updateCommentFloorById
(
comment
.
_id
,
i
+
1
,
function
(
err
,
docc
){
if
(
err
)
{
console
.
error
(
err
);
// callback(err,null);
}
else
{
callback
(
null
,
null
);
}
})
});
}
}
],
function
(
err
,
resultsss
)
{
}
if
(
err
)
{
],
function
(
err
,
resultsss
)
{
console
.
error
(
err
);
if
(
err
)
{
// callback(err,null
);
console
.
error
(
err
);
}
else
{
// callback(err,null);
// callback(null,null);
}
else
{
}
// callback2(null,null);
}
);
}
});
});
});
async
.
parallel
(
asyncTasks
,
function
(
err
,
results
)
{
if
(
err
)
{
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
res
.
json
(
returnCode
.
SUCCESS
);
}
});
});
});
});
}
else
{
async
.
parallel
(
asyncTasks
,
function
(
err
,
results
)
{
res
.
json
(
returnCode
.
BUSY
);
if
(
err
)
{
}
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
// console.log("------------update done!-------------");
res
.
json
(
returnCode
.
SUCCESS
);
}
});
});
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment