Commit 575441b3 authored by 陈家荣's avatar 陈家荣

33

parent df044b44
...@@ -1021,17 +1021,13 @@ router.get('/thread/:tid/spreadchain', function(req, res, next) { ...@@ -1021,17 +1021,13 @@ router.get('/thread/:tid/spreadchain', function(req, res, next) {
// 导出文章评论内容 // 导出文章评论内容
router.get('/thread/:tid/exportComments', function(req, res, next) { router.get('/thread/:tid/exportComments', function(req, res, next) {
var tid = req.params.tid || null; var tid = req.params.tid || null;
// var ent_code = req.query.ent_code;
if(req.query.ent_code){ if(req.query.ent_code){
var ent_code = req.query.ent_code; var ent_code = req.query.ent_code;
}else{ }else{
var ent_code = 100056; var ent_code = 100056;
} }
if(tid){ if(tid){
var conditions = { var conditions = {
ent_code: ent_code, ent_code: ent_code,
thread: tid thread: tid
...@@ -1081,7 +1077,7 @@ router.get('/thread/:tid/exportComments', function(req, res, next) { ...@@ -1081,7 +1077,7 @@ router.get('/thread/:tid/exportComments', function(req, res, next) {
//表头 //表头
var conf = {}; var conf = {};
conf.cols = [ conf.cols = [
{caption:'楼层', type:'number'}, {caption:'楼层', type:'string'},
{caption:'发布时间', type:'Date'}, {caption:'发布时间', type:'Date'},
{caption:'会员名', type:'string'}, {caption:'会员名', type:'string'},
{caption:'内容', type:'string'}, {caption:'内容', type:'string'},
...@@ -1105,37 +1101,21 @@ router.get('/thread/:tid/exportComments', function(req, res, next) { ...@@ -1105,37 +1101,21 @@ router.get('/thread/:tid/exportComments', function(req, res, next) {
praiseNames = comment.praiseNames.toString(); praiseNames = comment.praiseNames.toString();
} }
var this_row = [floor, time, nickName, content, praiseCount, praiseNames]; var this_row = [floor + '', time, nickName, content, praiseCount, praiseNames];
rows.push(this_row); rows.push(this_row);
if(comment.comments.length > 0){ if(comment.comments.length > 0){
for (var i = comment.comments.length - 1; i >= 0; i--) { for (var i = comment.comments.length - 1; i >= 0; i--) {
var sub_comment = comment.comments[i]; var sub_comment = comment.comments[i];
var floor = sub_comment.floor;
var time = date_format(sub_comment.created); var time = date_format(sub_comment.created);
var nickName = sub_comment.from.nickName || ''; var nickName = sub_comment.from.nickName || '';
var content = sub_comment.content || ''; var content = sub_comment.content || '';
var praiseCount = sub_comment.praiseCount || 0;
var praiseNames = ''; var this_row = ['子评论', time, nickName, content, null, null];
if(comment.praiseNames){
praiseNames = comment.praiseNames.toString();
}
var this_row = [null, time, nickName, content, praiseCount, praiseNames];
rows.push(this_row); rows.push(this_row);
// console.log(time);
// console.log(nickName);
// console.log(content);
// console.log(praiseNames);
// console.log(praiseCount);
}; };
} }
}; };
conf.rows = rows; conf.rows = rows;
......
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