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
ff5b00a8
Commit
ff5b00a8
authored
Dec 15, 2015
by
陈家荣
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update荣誉头衔管理功能
parent
7e5261d4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
11 deletions
+62
-11
forumHonorTitle.js
app/controllers/admin/forumHonorTitle.js
+21
-2
forumUser.js
app/models/forumUser.js
+4
-0
forumHonorTitleService.js
app/service/forumHonorTitleService.js
+13
-1
forumUserService.js
app/service/forumUserService.js
+24
-8
No files found.
app/controllers/admin/forumHonorTitle.js
View file @
ff5b00a8
...
...
@@ -145,8 +145,8 @@ router.put('/honorTitle/moveUP/:id/:order', function(req, res, next) {
});
});
//查询
所有
router
.
get
(
'/honorTitle/
l
ist'
,
function
(
req
,
res
,
next
)
{
//查询
列表
router
.
get
(
'/honorTitle/
searchL
ist'
,
function
(
req
,
res
,
next
)
{
var
pageNo
=
req
.
query
.
pageNo
||
1
,
pageSize
=
req
.
query
.
pageSize
||
10
,
titleName
=
req
.
query
.
titleName
||
''
;
...
...
@@ -170,3 +170,22 @@ router.get('/honorTitle/list', function(req, res, next) {
});
});
//获取状态为启用的
router
.
get
(
'/honorTitle/list'
,
function
(
req
,
res
,
next
)
{
var
conditions
=
{
ent_code
:
req
.
session
.
user
.
ent_code
,
status
:
1
};
forumHonorTitleService
.
find
(
conditions
,
function
(
err
,
results
){
if
(
err
){
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
var
rs
=
{
data
:
results
};
res
.
json
(
_
.
assign
(
rs
,
returnCode
.
SUCCESS
));
}
});
});
app/models/forumUser.js
View file @
ff5b00a8
...
...
@@ -52,6 +52,10 @@ var ForumUserSchema = new Schema({
require
:
true
,
default
:
1
},
honorTitles
:
[{
//荣誉头衔数组
type
:
Schema
.
Types
.
ObjectId
,
ref
:
'ForumHonorTitle'
}],
created
:
{
type
:
Date
,
required
:
true
,
...
...
app/service/forumHonorTitleService.js
View file @
ff5b00a8
...
...
@@ -63,7 +63,7 @@ function countAll(conditions,callback) {
});
}
//
获取全部列表数据
//
分页查询
exports
.
getAll
=
function
(
conditions
,
pageNo
,
pageSize
,
callback
)
{
countAll
(
conditions
,
function
(
err
,
count
){
if
(
err
){
...
...
@@ -89,6 +89,18 @@ exports.getAll= function(conditions,pageNo,pageSize,callback) {
});
};
//获取列表
exports
.
find
=
function
(
conditions
,
callback
){
ForumHonorTitle
.
find
(
conditions
,
function
(
err
,
docs
)
{
if
(
err
)
{
console
.
error
(
err
);
callback
(
err
,
null
);
}
else
{
callback
(
null
,
docs
);
}
});
};
exports
.
getAllOrderIDX
=
function
(
conditions
,
callback
){
ForumHonorTitle
.
find
(
conditions
).
select
(
'_id order_idx'
).
sort
({
order_idx
:
-
1
}).
exec
(
function
(
err
,
docs
)
{
if
(
err
)
{
...
...
app/service/forumUserService.js
View file @
ff5b00a8
...
...
@@ -3,8 +3,6 @@ var mongoose = require('mongoose');
var
ForumUser
=
mongoose
.
model
(
'ForumUser'
);
var
then
=
require
(
'thenjs'
);
var
async
=
require
(
'async'
);
// var forumLimitActionRefService = require('../service/forumLimitActionRefService');
// var forumLimitActionConfigService = require('../service/forumLimitActionConfigService');
var
forumLimitOperationService
=
require
(
'../service/forumLimitOperationService'
);
...
...
@@ -23,7 +21,10 @@ exports.createUser=function(entity,callback){
//根据Uid获取用户
exports
.
getUserByUid
=
function
(
uid
,
callback
){
ForumUser
.
findOne
({
uid
:
uid
}).
populate
(
'honorTitles'
).
exec
(
function
(
err
,
result
){
ForumUser
.
findOne
({
uid
:
uid
}).
populate
({
path
:
'honorTitles'
,
match
:
{
status
:
{
$ne
:
0
}}
}).
exec
(
function
(
err
,
result
){
if
(
err
){
callback
(
err
,
null
);
}
else
{
...
...
@@ -38,7 +39,10 @@ exports.getUserByUid=function(uid,callback){
//根据id获取用户
exports
.
getUserById
=
function
(
id
,
callback
){
ForumUser
.
findOne
({
_id
:
id
}).
populate
(
'honorTitles'
).
exec
(
function
(
err
,
result
){
ForumUser
.
findOne
({
_id
:
id
}).
populate
({
path
:
'honorTitles'
,
match
:
{
status
:
{
$ne
:
0
}}
}).
exec
(
function
(
err
,
result
){
if
(
err
){
callback
(
err
,
null
);
}
else
{
...
...
@@ -70,7 +74,10 @@ exports.searchMembers=function(pageNo, pageSize, q, callback){
}).
then
(
function
(
cont
,
count
)
{
var
skip
=
(
pageNo
-
1
)
*
pageSize
;
var
limit
=
count
-
skip
>
pageSize
?
pageSize
:
(
count
-
skip
);
ForumUser
.
find
(
q
).
skip
(
skip
).
limit
(
limit
).
sort
(
'-created'
).
populate
(
'honorTitles'
).
exec
(
function
(
err
,
docs
)
{
ForumUser
.
find
(
q
).
skip
(
skip
).
limit
(
limit
).
sort
(
'-created'
).
populate
({
path
:
'honorTitles'
,
match
:
{
status
:
{
$ne
:
0
}}
}).
exec
(
function
(
err
,
docs
)
{
cont
(
err
,
count
,
docs
);
});
}).
then
(
function
(
cont
,
count
,
members
)
{
...
...
@@ -98,7 +105,10 @@ exports.searchMembersByNickName=function(nickName, callback){
{
displayName
:
{
$regex
:
nickName
,
$options
:
'i'
}}
]
};
ForumUser
.
find
(
name
).
populate
(
'honorTitles'
).
exec
(
function
(
err
,
result
){
ForumUser
.
find
(
name
).
populate
({
path
:
'honorTitles'
,
match
:
{
status
:
{
$ne
:
0
}}
}).
exec
(
function
(
err
,
result
){
if
(
err
){
callback
(
err
,
null
);
}
else
{
...
...
@@ -109,7 +119,10 @@ exports.searchMembersByNickName=function(nickName, callback){
//根据mid查询用户
exports
.
searchMembersByMid
=
function
(
mid
,
callback
){
ForumUser
.
find
({
mid
:
mid
}).
populate
(
'honorTitles'
).
exec
(
function
(
err
,
result
){
ForumUser
.
find
({
mid
:
mid
}).
populate
({
path
:
'honorTitles'
,
match
:
{
status
:
{
$ne
:
0
}}
}).
exec
(
function
(
err
,
result
){
if
(
err
){
callback
(
err
,
null
);
}
else
{
...
...
@@ -125,7 +138,10 @@ exports.searchMembersAndLimitActions=function(pageNo, pageSize, q, callback){
}).
then
(
function
(
cont
,
count
)
{
var
skip
=
(
pageNo
-
1
)
*
pageSize
;
var
limit
=
count
-
skip
>
pageSize
?
pageSize
:
(
count
-
skip
);
ForumUser
.
find
(
q
).
skip
(
skip
).
limit
(
limit
).
sort
(
'-created'
).
populate
(
'honorTitles'
).
exec
(
function
(
err
,
docs
)
{
ForumUser
.
find
(
q
).
skip
(
skip
).
limit
(
limit
).
sort
(
'-created'
).
populate
({
path
:
'honorTitles'
,
match
:
{
status
:
{
$ne
:
0
}}
}).
exec
(
function
(
err
,
docs
)
{
cont
(
err
,
count
,
docs
);
});
}).
then
(
function
(
cont
,
count
,
members
)
{
...
...
strong
@strong
mentioned in commit
075b79ef
·
Dec 15, 2015
mentioned in commit
075b79ef
mentioned in commit 075b79effba61ecc4b651ce1d948f8a4fbc4b546
Toggle commit list
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