Commit 1bc91e62 authored by 陈家荣's avatar 陈家荣

添加、更新评论

parent b33fa754
...@@ -121,12 +121,17 @@ router.get('/thread/:tid/get', function(req, res, next) { ...@@ -121,12 +121,17 @@ router.get('/thread/:tid/get', function(req, res, next) {
//更新文章状态、如:屏蔽 //更新文章状态、如:屏蔽
router.post('/thread/:tid/update', function(req, res, next) { router.post('/thread/:tid/update', function(req, res, next) {
var tid=req.params.tid; var tid=req.params.tid;
var fatherTitle = req.body.father;
delete req.body.father;
req.body.ent_code=req.session.user.ent_code;
if(tid){ if(tid){
forumThreadService.updateThreadById(tid,req.body,function(err,thread){ forumThreadService.updateThreadById(tid,req.body,function(err,thread){
if(err){ if(err){
res.json(returnCode.BUSY); res.json(returnCode.BUSY);
}else{ }else{
res.json(returnCode.SUCCESS); console.log(thread);
console.log(fatherTitle);
res.json({message:"success",data:thread,title:fatherTitle});
} }
}); });
}else{ }else{
...@@ -134,6 +139,7 @@ router.post('/thread/:tid/update', function(req, res, next) { ...@@ -134,6 +139,7 @@ router.post('/thread/:tid/update', function(req, res, next) {
} }
}); });
//删除文章 //删除文章
router.post('/thread/:tid/delete', function(req, res, next) { router.post('/thread/:tid/delete', function(req, res, next) {
var tid=req.params.tid; var tid=req.params.tid;
...@@ -196,6 +202,7 @@ router.get('/threads/list', function(req, res, next) { ...@@ -196,6 +202,7 @@ router.get('/threads/list', function(req, res, next) {
var pageSize = req.query.pageSize || 10; var pageSize = req.query.pageSize || 10;
var infoId=req.query.infoId; var infoId=req.query.infoId;
var tagId=req.query.tagId; var tagId=req.query.tagId;
var pid=req.query.pid;
var conditions={ var conditions={
ent_code:req.session.user.ent_code, ent_code:req.session.user.ent_code,
level:1 level:1
...@@ -206,6 +213,13 @@ router.get('/threads/list', function(req, res, next) { ...@@ -206,6 +213,13 @@ router.get('/threads/list', function(req, res, next) {
if(tagId){ if(tagId){
conditions.tag={$in:[tagId]}; conditions.tag={$in:[tagId]};
} }
if(pid){
conditions.pid = pid;
conditions.level = 2;
}
console.log(conditions);
forumThreadService.getAllThreadByFid(conditions,pageNo,pageSize,null,function(err,results){ forumThreadService.getAllThreadByFid(conditions,pageNo,pageSize,null,function(err,results){
if(err){ if(err){
console.error(err); console.error(err);
...@@ -216,6 +230,7 @@ router.get('/threads/list', function(req, res, next) { ...@@ -216,6 +230,7 @@ router.get('/threads/list', function(req, res, next) {
}); });
}); });
//评论列表 //评论列表
router.get('/thread/:tid/comment/list', function(req, res, next) { router.get('/thread/:tid/comment/list', function(req, res, next) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment