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
eba8660d
Commit
eba8660d
authored
May 16, 2016
by
刘文胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
111
parent
c65c3a02
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
76 additions
and
1 deletion
+76
-1
forumThreadManagement.js
app/controllers/admin/forumThreadManagement.js
+76
-1
No files found.
app/controllers/admin/forumThreadManagement.js
View file @
eba8660d
...
@@ -10,7 +10,8 @@ var router = require('express').Router(),
...
@@ -10,7 +10,8 @@ var router = require('express').Router(),
//模型
//模型
var
ForumThread
=
mongoose
.
model
(
'ForumThread'
),
var
ForumThread
=
mongoose
.
model
(
'ForumThread'
),
ForumComment
=
mongoose
.
model
(
'ForumComment'
),
ForumComment
=
mongoose
.
model
(
'ForumComment'
),
ForumPVLog
=
mongoose
.
model
(
'ForumPVLog'
);
ForumPVLog
=
mongoose
.
model
(
'ForumPVLog'
),
ForumFollowThread
=
mongoose
.
model
(
'ForumFollowThread'
);
//服务
//服务
var
forumThreadService
=
require
(
'../../service/forumThreadService'
),
var
forumThreadService
=
require
(
'../../service/forumThreadService'
),
forumUserService
=
require
(
'../../service/forumUserService'
),
forumUserService
=
require
(
'../../service/forumUserService'
),
...
@@ -613,3 +614,77 @@ router.get('/threadManagement/threads/:tid/comment/search', function(req, res, n
...
@@ -613,3 +614,77 @@ router.get('/threadManagement/threads/:tid/comment/search', function(req, res, n
res
.
json
(
returnCode
.
WRONG_PARAM
);
res
.
json
(
returnCode
.
WRONG_PARAM
);
}
}
});
});
//查询帖子的收藏数
router
.
get
(
'/threadManagement/threads/:tid/collects'
,
function
(
req
,
res
,
next
)
{
var
tid
=
req
.
params
.
tid
||
null
;
var
ent_code
=
req
.
session
.
user
.
ent_code
;
var
conditions
=
{
ent_code
:
ent_code
,
thread
:
tid
};
if
(
tid
&&
ent_code
)
{
ForumFollowThread
.
count
(
conditions
,
function
(
err
,
count
)
{
if
(
err
)
{
res
.
json
(
returnCode
.
BUSY
);
}
else
{
res
.
json
(
_
.
assign
({
data
:(
count
||
0
)},
returnCode
.
SUCCESS
));
}
});
}
else
{
res
.
json
(
returnCode
.
WRONG_PARAM
);
}
});
//查询帖子的子文章数
router
.
get
(
'/threadManagement/threads/:tid/subtotal'
,
function
(
req
,
res
,
next
)
{
var
tid
=
req
.
params
.
tid
||
null
;
var
ent_code
=
req
.
session
.
user
.
ent_code
;
var
conditions
=
{
ent_code
:
ent_code
,
pid
:
tid
,
status
:
1
};
if
(
tid
&&
ent_code
)
{
ForumThread
.
count
(
conditions
,
function
(
err
,
count
)
{
if
(
err
)
{
res
.
json
(
returnCode
.
BUSY
);
}
else
{
res
.
json
(
_
.
assign
({
data
:(
count
||
0
)},
returnCode
.
SUCCESS
));
}
});
}
else
{
res
.
json
(
returnCode
.
WRONG_PARAM
);
}
});
//查询(话题/照片墙)的参与人数
router
.
get
(
'/threadManagement/threads/:tid/joined/total'
,
function
(
req
,
res
,
next
)
{
var
tid
=
req
.
params
.
tid
||
null
;
var
ent_code
=
req
.
session
.
user
.
ent_code
;
if
(
tid
&&
ent_code
)
{
ForumThread
.
aggregate
({
$match
:
{
ent_code
:
ent_code
,
pid
:
mongoose
.
Types
.
ObjectId
(
tid
)
}
},
{
$group
:
{
_id
:
{
from
:
'$from'
},
count
:
{
$sum
:
1
}
}
},
function
(
err
,
data
)
{
if
(
err
)
{
res
.
json
(
returnCode
.
BUSY
);
}
else
{
res
.
json
(
_
.
assign
({
data
:((
data
&&
data
.
length
)
||
0
)},
returnCode
.
SUCCESS
));
}
});
}
else
{
res
.
json
(
returnCode
.
WRONG_PARAM
);
}
});
\ No newline at end of file
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