Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pisns-forum-api
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
scrmGroup
pisns-forum-api
Commits
fb4ea06a
Commit
fb4ea06a
authored
Oct 14, 2015
by
陈志良
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
评论下载 - 添加文章基本信息
parent
47493325
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
25 deletions
+72
-25
forumThread.js
app/controllers/admin/forumThread.js
+72
-25
No files found.
app/controllers/admin/forumThread.js
View file @
fb4ea06a
...
@@ -1027,6 +1027,37 @@ router.get('/thread/:tid/exportComments', function(req, res, next) {
...
@@ -1027,6 +1027,37 @@ router.get('/thread/:tid/exportComments', function(req, res, next) {
ent_code
=
req
.
query
.
ent_code
||
null
;
ent_code
=
req
.
query
.
ent_code
||
null
;
then
(
function
(
cont
){
then
(
function
(
cont
){
if
(
tid
&&
ent_code
){
if
(
tid
&&
ent_code
){
then
.
parallel
([
function
(
cont2
){
forumThreadService
.
getThreadByIdSimple
({
_id
:
tid
},
function
(
err
,
doc
){
forumPraiseLogService
.
queryPraiseLogV2
({
ent_code
:
ent_code
,
thread
:
tid
,
type
:
1
},
function
(
err
,
results
){
if
(
err
){
cont2
(
err
);
}
else
{
if
(
results
&&
results
.
length
>
0
){
var
praiseNames
=
[];
var
praiseOpenIds
=
[];
_
.
forEach
(
results
,
function
(
e
)
{
if
(
e
.
user
){
praiseNames
.
push
(
e
.
user
.
nickName
||
'游客'
);
praiseOpenIds
.
push
(
e
.
user
.
uid
);
}
});
doc
=
doc
.
toObject
();
doc
.
praiseNames
=
praiseNames
.
toString
();
doc
.
praiseOpenIds
=
praiseOpenIds
.
toString
();
cont2
(
null
,
doc
);
}
else
{
doc
=
doc
.
toObject
();
doc
.
praiseNames
=
''
;
doc
.
praiseOpenIds
=
''
;
cont2
(
null
,
doc
);
}
}
});
});
},
function
(
cont2
){
var
conditions
=
{
var
conditions
=
{
ent_code
:
ent_code
,
ent_code
:
ent_code
,
thread
:
tid
,
thread
:
tid
,
...
@@ -1034,12 +1065,19 @@ router.get('/thread/:tid/exportComments', function(req, res, next) {
...
@@ -1034,12 +1065,19 @@ router.get('/thread/:tid/exportComments', function(req, res, next) {
};
};
//查询所有评论
//查询所有评论
forumCommentService
.
getAllCommentByThread
(
conditions
,
function
(
err
,
docs
)
{
forumCommentService
.
getAllCommentByThread
(
conditions
,
function
(
err
,
docs
)
{
cont
(
err
,
docs
);
cont2
(
err
,
docs
);
});
});
}
]).
then
(
function
(
cont2
,
datas
){
cont
(
null
,
datas
[
0
],
datas
[
1
]);
}).
fail
(
function
(
cont2
,
err
){
cont
(
err
);
});
}
else
{
}
else
{
cont
(
'params error'
);
cont
(
'params error'
);
}
}
}).
then
(
function
(
cont
,
comments
){
}).
then
(
function
(
cont
,
thread
,
comments
){
//获取点赞信息
//获取点赞信息
var
asyncTasks
=
[];
var
asyncTasks
=
[];
_
.
forEach
(
comments
,
function
(
e
)
{
_
.
forEach
(
comments
,
function
(
e
)
{
...
@@ -1052,7 +1090,6 @@ router.get('/thread/:tid/exportComments', function(req, res, next) {
...
@@ -1052,7 +1090,6 @@ router.get('/thread/:tid/exportComments', function(req, res, next) {
}
}
forumPraiseLogService
.
queryPraiseLogV2
(
conditions
,
function
(
err
,
results
){
forumPraiseLogService
.
queryPraiseLogV2
(
conditions
,
function
(
err
,
results
){
if
(
err
){
if
(
err
){
console
.
log
(
err
);
cb
(
null
,
e
);
cb
(
null
,
e
);
}
else
{
}
else
{
if
(
results
){
if
(
results
){
...
@@ -1064,9 +1101,8 @@ router.get('/thread/:tid/exportComments', function(req, res, next) {
...
@@ -1064,9 +1101,8 @@ router.get('/thread/:tid/exportComments', function(req, res, next) {
praiseOpenIds
.
push
(
e2
.
user
.
uid
);
praiseOpenIds
.
push
(
e2
.
user
.
uid
);
}
}
});
});
e
.
praiseNames
=
praiseNames
;
e
.
praiseNames
=
praiseNames
.
toString
();
e
.
praiseOpenIds
=
praiseOpenIds
;
e
.
praiseOpenIds
=
praiseOpenIds
.
toString
();
e
.
praiseCount
=
results
.
length
;
}
}
cb
(
null
,
e
);
cb
(
null
,
e
);
}
}
...
@@ -1074,23 +1110,35 @@ router.get('/thread/:tid/exportComments', function(req, res, next) {
...
@@ -1074,23 +1110,35 @@ router.get('/thread/:tid/exportComments', function(req, res, next) {
});
});
});
});
async
.
parallel
(
asyncTasks
,
function
(
err
,
items
)
{
async
.
parallel
(
asyncTasks
,
function
(
err
,
items
)
{
cont
(
err
,
items
);
cont
(
err
,
thread
,
items
);
});
});
}).
then
(
function
(
cont
,
items
){
}).
then
(
function
(
cont
,
thread
,
items
){
//表头
//表头
var
conf
=
{};
var
conf
=
{},
rows
=
[];
conf
.
cols
=
[
conf
.
cols
=
[
{
caption
:
'楼层'
,
type
:
'string'
},
{
caption
:
'帖子标题'
,
type
:
'string'
},
{
caption
:
'发布时间'
,
type
:
'Date'
},
{
caption
:
'发布时间'
,
type
:
'string'
},
{
caption
:
'发帖人'
,
type
:
'string'
},
{
caption
:
'openId'
,
type
:
'string'
},
{
caption
:
'openId'
,
type
:
'string'
},
{
caption
:
'会员名'
,
type
:
'string'
},
{
caption
:
'内容'
,
type
:
'string'
},
{
caption
:
'内容'
,
type
:
'string'
},
{
caption
:
'点赞数'
,
type
:
'number'
},
{
caption
:
'评论数'
,
type
:
'number'
},
{
caption
:
'转发数'
,
type
:
'string'
},
{
caption
:
'点赞数'
,
type
:
'string'
},
{
caption
:
'点赞人'
,
type
:
'string'
},
{
caption
:
'点赞人'
,
type
:
'string'
},
{
caption
:
'点赞人openId'
,
type
:
'string'
}
{
caption
:
'点赞
点赞
人openId'
,
type
:
'string'
}
];
];
//内容
//内容
var
rows
=
[];
//文章内容
var
t_title
=
thread
.
title
==
'发话题'
?
'无标题'
:
thread
.
title
,
t_time
=
date_format
(
thread
.
created
),
t_from
=
thread
.
from
?
thread
.
from
.
nickName
:
'游客'
,
t_from_openId
=
thread
.
from
?
thread
.
from
.
uid
:
''
,
t_praiseNames
=
thread
.
praiseNames
,
t_praiseOpenIds
=
thread
.
praiseOpenIds
;
rows
.
push
([
t_title
,
t_time
,
t_from
,
t_from_openId
,
thread
.
content
,
thread
.
comment_count
,
thread
.
share_count
.
toString
(),
thread
.
praise_count
.
toString
(),
t_praiseNames
,
t_praiseOpenIds
]);
rows
.
push
([
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
,
''
]);
rows
.
push
([
'楼层'
,
'发布时间'
,
'openId'
,
'会员名'
,
'内容'
,
'点赞数'
,
'点赞人'
,
'点赞人openId'
,
''
,
''
]);
for
(
var
i
=
items
.
length
-
1
;
i
>=
0
;
i
--
)
{
for
(
var
i
=
items
.
length
-
1
;
i
>=
0
;
i
--
)
{
var
comment
=
items
[
i
];
var
comment
=
items
[
i
];
var
floor
=
comment
.
floor
,
var
floor
=
comment
.
floor
,
...
@@ -1110,9 +1158,8 @@ router.get('/thread/:tid/exportComments', function(req, res, next) {
...
@@ -1110,9 +1158,8 @@ router.get('/thread/:tid/exportComments', function(req, res, next) {
nickName
=
comment
.
from
.
nickName
||
'游客'
;
nickName
=
comment
.
from
.
nickName
||
'游客'
;
}
}
var
this_row
=
[
floor
+
''
,
time
,
openId
,
nickName
,
content
,
praiseCount
,
praiseNames
,
praiseOpenIds
];
var
this_row
=
[
floor
+
''
,
time
,
openId
,
nickName
,
content
,
praiseCount
,
praiseNames
,
praiseOpenIds
,
null
,
null
];
rows
.
push
(
this_row
);
rows
.
push
(
this_row
);
if
(
comment
.
comments
.
length
>
0
){
if
(
comment
.
comments
.
length
>
0
){
for
(
var
k
=
0
;
k
<
comment
.
comments
.
length
;
k
++
)
{
for
(
var
k
=
0
;
k
<
comment
.
comments
.
length
;
k
++
)
{
var
sub_comment
=
comment
.
comments
[
k
];
var
sub_comment
=
comment
.
comments
[
k
];
...
@@ -1129,7 +1176,7 @@ router.get('/thread/:tid/exportComments', function(req, res, next) {
...
@@ -1129,7 +1176,7 @@ router.get('/thread/:tid/exportComments', function(req, res, next) {
if
(
sub_comment
.
to
){
if
(
sub_comment
.
to
){
to
=
sub_comment
.
to
.
nickName
||
'游客'
;
to
=
sub_comment
.
to
.
nickName
||
'游客'
;
}
}
var
this_row
=
[
nickName
+
' 回复 '
+
to
,
time
,
openId
,
nickName
,
content
,
0
,
null
,
null
];
var
this_row
=
[
nickName
+
' 回复 '
+
to
,
time
,
openId
,
nickName
,
content
,
0
,
null
,
null
,
null
,
null
];
rows
.
push
(
this_row
);
rows
.
push
(
this_row
);
};
};
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment