Commit 13e85e0e authored by 陈志良's avatar 陈志良

图片墙发帖 - 合并帖子

parent d13937bc
...@@ -567,7 +567,7 @@ router.get('/info/myAttend', function(req, res, next) { ...@@ -567,7 +567,7 @@ router.get('/info/myAttend', function(req, res, next) {
}); });
cont(null,threadIds); cont(null,threadIds);
}else{ }else{
res.json(_.assign({data:[],total:0}, returnCode.SUCCESS)); res.json(_.assign({items:[],total:0}, returnCode.SUCCESS));
} }
} }
}); });
......
...@@ -32,6 +32,8 @@ function create(req, callback) { ...@@ -32,6 +32,8 @@ function create(req, callback) {
entity.pid = null; entity.pid = null;
} }
var address = entity.address || null; var address = entity.address || null;
if (address) { if (address) {
entity.address = JSON.parse(address); entity.address = JSON.parse(address);
...@@ -54,15 +56,39 @@ function create(req, callback) { ...@@ -54,15 +56,39 @@ function create(req, callback) {
entity.images = array; entity.images = array;
} }
//-----------处理前端上传图片结束 //-----------处理前端上传图片结束
if(entity.pid && entity.type == 3 ){
forumThreadService.createThread(entity, function(err, entity) { forumThreadService.getByConditions({type:3,level:'2',pid:entity.pid,from:entity.from},function(err,doc){
if (err) { if(doc){
console.error(err); var update = {
callback(err, null); $set:{
} else { images:entity.images,
callback(null, entity); content:entity.content
} }
}); };
forumThreadService.updateThreadById(doc._id,update,function(err,updatedDoc){
callback(err,entity);
});
}else{
forumThreadService.createThread(entity, function(err, entity) {
if (err) {
console.error(err);
callback(err, null);
} else {
callback(null, entity);
}
});
}
});
}else{
forumThreadService.createThread(entity, function(err, entity) {
if (err) {
console.error(err);
callback(err, null);
} else {
callback(null, entity);
}
});
}
} }
//根据发帖者分页查询话题列表 //根据发帖者分页查询话题列表
...@@ -235,6 +261,26 @@ router.get('/thread/:tid/get', function(req, res, next) { ...@@ -235,6 +261,26 @@ router.get('/thread/:tid/get', function(req, res, next) {
} }
}); });
//获取目标论坛文章
router.get('/thread/photo/:pid/get', function(req, res, next) {
var pid = req.params.pid || null,
userId = req.session.mobileForumUser.userId;;
if (pid) {
forumThreadService.getByConditions({type:3,level:'2',pid:pid,from:userId},function(err,thread){
if (err) {
console.error(err);
res.json(returnCode.BUSY);
} else {
var rs = {};
rs.data = thread;
res.json(_.assign(rs, returnCode.SUCCESS));
}
});
} else {
res.json(returnCode.WRONG_PARAM);
}
});
//更新文章状态、如:屏蔽 //更新文章状态、如:屏蔽
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;
...@@ -1339,4 +1385,3 @@ router.post('/thread/:tid/disable', function(req, res, next) { ...@@ -1339,4 +1385,3 @@ router.post('/thread/:tid/disable', function(req, res, next) {
res.json(returnCode.WRONG_PARAM); res.json(returnCode.WRONG_PARAM);
} }
}); });
...@@ -122,7 +122,17 @@ exports.getById = function(id, callback) { ...@@ -122,7 +122,17 @@ exports.getById = function(id, callback) {
} }
}); });
} }
//根据ID获取文章记录,不查评论,子话题
exports.getByConditions = function(conditions, callback) {
ForumThread.findOne(conditions, function(err, result) {
if (err) {
console.error(err);
callback(err, null);
} else {
callback(null, result);
}
});
}
//根据ID获取文章 //根据ID获取文章
exports.getThreadById = function(tid, callback) { exports.getThreadById = function(tid, callback) {
async.parallel([ async.parallel([
...@@ -1033,4 +1043,5 @@ exports.getAllThreadByFidAndNickName = function(nickName, conditions, pageNo, pa ...@@ -1033,4 +1043,5 @@ exports.getAllThreadByFidAndNickName = function(nickName, conditions, pageNo, pa
} }
}); });
} }
\ No newline at end of file //获取某个文章
...@@ -67,7 +67,7 @@ var config = { ...@@ -67,7 +67,7 @@ var config = {
app: { app: {
name: 'pisns-forum-api' name: 'pisns-forum-api'
}, },
service:'http://pisns.wxpai.cn', service:'http://piplus.wxpai.cn',
port: 3011, port: 3011,
mongodb: { mongodb: {
...@@ -86,9 +86,9 @@ var config = { ...@@ -86,9 +86,9 @@ var config = {
devCDNURL: 'http://dev.fs.wxpai.cn/' devCDNURL: 'http://dev.fs.wxpai.cn/'
}, },
sessionStore: { sessionStore: {
password: 'future123456', password: 'a39131f8d598429f:GuangZhouhdp123',
port: 6379, port: 6379,
host: '10.168.27.179', host: 'a39131f8d598429f.m.cnhza.kvstore.aliyuncs.com',
db: 2 db: 2
} }
} }
......
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