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
9e39925a
Commit
9e39925a
authored
Apr 20, 2015
by
刘文胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
黑名单
parent
92ddf72f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
8 deletions
+28
-8
forumBlackList.js
app/controllers/admin/forumBlackList.js
+5
-3
forumUserService.js
app/service/forumUserService.js
+23
-5
No files found.
app/controllers/admin/forumBlackList.js
View file @
9e39925a
...
...
@@ -102,13 +102,15 @@ router.post('/blacklist/:id', function(req, res, next) {
});
router
.
get
(
'/userList'
,
function
(
req
,
res
,
next
)
{
var
obj
=
{};
var
obj
=
{
total
:
0
};
obj
.
items
=
[];
ForumUserService
.
getUsers
(
function
(
err
,
results
){
ForumUserService
.
getUsers
(
req
.
query
.
pageNo
,
req
.
query
.
pageSize
,
function
(
err
,
result
){
if
(
err
){
res
.
json
(
returnCode
.
BUSY
);
}
else
{
obj
.
items
=
results
;
obj
.
items
=
result
.
items
;
obj
.
total
=
result
.
total
;
res
.
json
(
_
.
assign
(
obj
,
returnCode
.
SUCCESS
));
}
});
...
...
app/service/forumUserService.js
View file @
9e39925a
...
...
@@ -58,15 +58,33 @@ exports.updateUserById=function(uid,entity,callback){
};
exports
.
getUsers
=
function
(
callback
){
ForumUser
.
find
({}).
exec
(
function
(
err
,
results
){
exports
.
getUsers
=
function
(
pageNo
,
pageSize
,
callback
){
var
pageNo
=
pageNo
||
1
;
var
pageSize
=
pageSize
||
10
;
var
getPageList
=
function
(
count
){
var
skip
=
(
pageNo
-
1
)
*
pageSize
;
var
limit
=
count
-
skip
>
pageSize
?
pageSize
:
(
count
-
skip
);
ForumUser
.
find
({}).
limit
(
limit
).
skip
(
skip
)
.
exec
(
function
(
err
,
results
){
if
(
err
){
callback
(
err
,
null
);
}
else
{
if
(
results
){
callback
(
null
,{
total
:
count
,
items
:
results
});
}
else
{
callback
(
null
,{
total
:
count
,
items
:[]});
}
}
});
};
ForumUser
.
count
({}).
exec
(
function
(
err
,
count
){
if
(
err
){
callback
(
err
,
null
);
}
else
{
if
(
results
){
callback
(
null
,
results
);
if
(
count
>
0
){
getPageList
(
count
);
}
else
{
callback
(
null
,
null
);
callback
(
null
,
{
total
:
0
,
items
:[]}
);
}
}
});
...
...
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