Commit 289fb8af authored by 陈志良's avatar 陈志良

后台修改前端发布帖子限制更新内容

parent 87b7cf4b
...@@ -269,20 +269,43 @@ router.post('/thread/:tid/update', function(req, res, next) { ...@@ -269,20 +269,43 @@ router.post('/thread/:tid/update', function(req, res, next) {
delete req.body.father; delete req.body.father;
req.body.ent_code = req.session.user.ent_code; req.body.ent_code = req.session.user.ent_code;
if (tid) { if (tid) {
forumThreadService.updateThreadById(tid, req.body, function(err, thread) { forumThreadService.getById(tid,function(err,doc){
if (err) { if(err || !doc){
res.json(returnCode.BUSY); res.json(returnCode.WRONG_PARAM);
} else { }
if (!isNaN(req.body.status)) { //如果修改的帖子为手机端发布的,则限制更新信息
forumAboutMEService.updateThreadStatus(thread._id, thread.status) if(doc.isPublishByBg == 0){
var body = req.body;
req.body = {};
if(body.status != null ){
req.body.status = body.status;
}
if(body.isEvent != null){
req.body.isEvent = body.isEvent;
if(body.event != null){
req.body.event = body.event;
}
}
if(body.tag != null){
req.body.tag = body.tag;
} }
res.json({
message: "success",
data: thread,
title: fatherTitle
});
} }
forumThreadService.updateThreadById(tid, req.body, function(err, thread) {
if (err) {
res.json(returnCode.BUSY);
} else {
if (!isNaN(req.body.status)) {
forumAboutMEService.updateThreadStatus(thread._id, thread.status)
}
res.json({
message: "success",
data: thread,
title: fatherTitle
});
}
});
}); });
} else { } else {
res.json(returnCode.WRONG_PARAM); res.json(returnCode.WRONG_PARAM);
} }
......
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