...
|
...
|
@@ -99,6 +99,7 @@ exports.tags = (req, res, next) => { |
|
|
|
|
|
tag: query,
|
|
|
guangIndexPage: true,
|
|
|
baseUrl: `?${querystring.stringify(req.query)}`,
|
|
|
pageSize: pageSize,
|
|
|
type: type,
|
|
|
pathNav: pathNav,
|
...
|
...
|
@@ -140,18 +141,14 @@ exports.editor = (req, res, next) => { |
|
|
res.render('editor', {
|
|
|
title: ret[0].name + (res.locals.title || ''),
|
|
|
guang: {
|
|
|
editor: {
|
|
|
avatar: ret[0] && ret[0].avatar,
|
|
|
name: ret[0] && ret[0].name,
|
|
|
intro: ret[0] && ret[0].author_desc,
|
|
|
info: '设计理念:时尚,线条流畅'
|
|
|
},
|
|
|
editor: ret[0],
|
|
|
msgs: ret[1] && ret[1].msgs,
|
|
|
hotTags: ret[2],
|
|
|
ads: ret[3],
|
|
|
exRecos: ret[4],
|
|
|
|
|
|
gender: gender,
|
|
|
baseUrl: `?${querystring.stringify(req.query)}`,
|
|
|
pageSize: pageSize,
|
|
|
pathNav: pathNav,
|
|
|
page: page,
|
...
|
...
|
@@ -171,7 +168,7 @@ exports.detail = (req, res, next) => { |
|
|
|
|
|
let id = req.params.id || req.query.id;
|
|
|
let page = req.query.page || 1;
|
|
|
let pageSize = req.query.pageSize || 20;
|
|
|
let pageSize = req.query.pageSize || 10;
|
|
|
let col = req.query.col || 0;
|
|
|
let pjax = req.query._pjax;
|
|
|
let uid = req.user.uid;
|
...
|
...
|
@@ -184,9 +181,20 @@ exports.detail = (req, res, next) => { |
|
|
}
|
|
|
|
|
|
if (pjax) {
|
|
|
return guangModel.getArticleComments(id, page, pageSize).then(ret => {
|
|
|
return res.render('comment', ret);
|
|
|
guangModel.getArticleComments(id, page, pageSize).then(ret => {
|
|
|
|
|
|
res.render('detail-comment', {
|
|
|
layout: false,
|
|
|
comment: ret
|
|
|
}, function(err, html) {
|
|
|
if (err) {
|
|
|
return res.send('');
|
|
|
}
|
|
|
return res.status(200).send(html);
|
|
|
});
|
|
|
});
|
|
|
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
// 登陆后自动收藏
|
...
|
...
|
@@ -276,8 +284,26 @@ exports.detail = (req, res, next) => { |
|
|
exports.listDynamicData = (req, res) => {
|
|
|
let ids = req.query.ids;
|
|
|
|
|
|
guangModel.getDynamicDataByIds(ids).then(ret => {
|
|
|
res.status(200).send(ret);
|
|
|
let udid = ghelper.getUdid(req, res);
|
|
|
|
|
|
let other = {};
|
|
|
let query = req.query.query,
|
|
|
type = req.query.type;
|
|
|
|
|
|
if (req.user.uid) {
|
|
|
other.uid = req.user.uid;
|
|
|
}
|
|
|
|
|
|
if (query) {
|
|
|
other.query = query;
|
|
|
}
|
|
|
|
|
|
if (type) {
|
|
|
other.type = type;
|
|
|
}
|
|
|
|
|
|
guangModel.getDynamicDataByIds(ids, udid, other).then(ret => {
|
|
|
res.send(ret);
|
|
|
});
|
|
|
};
|
|
|
|
...
|
...
|
@@ -287,23 +313,17 @@ exports.listDynamicData = (req, res) => { |
|
|
* @param res
|
|
|
*/
|
|
|
exports.detailDynamicData = (req, res) => {
|
|
|
let id = req.query.id;
|
|
|
let id = req.query.id,
|
|
|
uid = req.user.uid,
|
|
|
udid = ghelper.getUdid(req, res);
|
|
|
|
|
|
guangModel.getDynamicDataByIds(id).then(ret => {
|
|
|
guangModel.getDynamicDataById(id, uid, udid).then((ret) => {
|
|
|
res.status(200).send(ret);
|
|
|
}).catch(() => {
|
|
|
res.status(400);
|
|
|
});
|
|
|
};
|
|
|
|
|
|
exports.detailCommentData = (req, res) => {
|
|
|
|
|
|
let param = {
|
|
|
id: req.query.id,
|
|
|
page: req.query.page
|
|
|
};
|
|
|
|
|
|
res.render('', param);
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 添加评论
|
|
|
*/
|
...
|
...
|
|