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
8efcbaec
Commit
8efcbaec
authored
Jan 08, 2016
by
strong
Browse files
Options
Browse Files
Download
Plain Diff
Merge commit '
b30b1406
'
# Conflicts: # app/models/forumThread.js
parents
2741cdb0
b30b1406
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
681 additions
and
214 deletions
+681
-214
forumMember.js
app/controllers/admin/forumMember.js
+27
-0
forumUser.js
app/controllers/mobile/forumUser.js
+346
-56
forumInfo.js
app/models/forumInfo.js
+4
-0
forumThread.js
app/models/forumThread.js
+4
-0
forumUser.js
app/models/forumUser.js
+16
-0
forumInfoService.js
app/service/forumInfoService.js
+12
-0
forumThreadService.js
app/service/forumThreadService.js
+12
-0
forumUserService.js
app/service/forumUserService.js
+260
-158
No files found.
app/controllers/admin/forumMember.js
View file @
8efcbaec
...
...
@@ -158,4 +158,31 @@ router.post('/member/:mid/update', function(req, res, next) {
}
else
{
res
.
json
(
returnCode
.
WRONG_PARAM
);
}
});
//获取用户收藏记录
router
.
get
(
'/member/:uid/favors'
,
function
(
req
,
res
,
next
)
{
var
uid
=
req
.
params
.
uid
||
null
;
var
ent_code
=
req
.
session
.
user
.
ent_code
;
if
(
uid
)
{
var
condition
=
{
_id
:
uid
,
ent_code
:
ent_code
}
forumUserService
.
getFavors
(
condition
,
function
(
err
,
result
){
if
(
err
){
console
.
log
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
var
rs
=
{
data
:
result
};
res
.
json
(
_
.
assign
(
rs
,
returnCode
.
SUCCESS
));
}
});
}
else
{
console
.
error
(
'params error'
);
res
.
json
({
result
:
false
,
err
:
'params error'
});
}
});
\ No newline at end of file
app/controllers/mobile/forumUser.js
View file @
8efcbaec
This diff is collapsed.
Click to expand it.
app/models/forumInfo.js
View file @
8efcbaec
...
...
@@ -50,6 +50,10 @@ var ForumInfoSchema = new Schema({
type
:
Object
,
default
:{}
},
favor_by
:
[{
//被收藏用户列表
type
:
Schema
.
Types
.
ObjectId
,
ref
:
'ForumUser'
}],
created
:
{
type
:
Date
,
required
:
true
,
...
...
app/models/forumThread.js
View file @
8efcbaec
...
...
@@ -126,6 +126,10 @@ var ForumThreadSchema = new Schema({
new_recommend_time
:{
//推荐时间
type
:
Date
},
favor_by
:
[{
//被收藏用户列表
type
:
Schema
.
Types
.
ObjectId
,
ref
:
'ForumUser'
}],
created
:
{
type
:
Date
,
required
:
true
,
...
...
app/models/forumUser.js
View file @
8efcbaec
...
...
@@ -56,6 +56,22 @@ var ForumUserSchema = new Schema({
type
:
Schema
.
Types
.
ObjectId
,
ref
:
'ForumHonorTitle'
}],
favor_by
:
[{
//被收藏用户列表
type
:
Schema
.
Types
.
ObjectId
,
ref
:
'ForumUser'
}],
favor_users
:
[{
//收藏用户列表
type
:
Schema
.
Types
.
ObjectId
,
ref
:
'ForumUser'
}],
favor_infos
:
[{
//收藏板块列表
type
:
Schema
.
Types
.
ObjectId
,
ref
:
'ForumInfo'
}],
favor_threads
:
[{
//收藏文章列表
type
:
Schema
.
Types
.
ObjectId
,
ref
:
'ForumThread'
}],
created
:
{
type
:
Date
,
required
:
true
,
...
...
app/service/forumInfoService.js
View file @
8efcbaec
...
...
@@ -39,6 +39,18 @@ exports.updateInfoById=function(fid,entity,callback){
});
};
//根据ID更新论坛板块2
exports
.
updateByIdWithOptions
=
function
(
condition
,
entity
,
options
,
callback
){
ForumInfo
.
findOneAndUpdate
(
condition
,
entity
,
options
,
function
(
err
,
result
)
{
if
(
err
)
{
console
.
error
(
err
);
callback
(
err
,
null
);
}
else
{
callback
(
null
,
null
);
}
});
};
//根据ID更新论坛组
exports
.
deleteInfoById
=
function
(
fid
,
callback
){
ForumInfo
.
remove
({
_id
:
fid
},
function
(
err
,
result
){
...
...
app/service/forumThreadService.js
View file @
8efcbaec
...
...
@@ -1241,4 +1241,16 @@ exports.updateThread = function(condition, entity, callback) {
callback
(
null
,
doc
);
}
});
};
//根据ID更新文章2
exports
.
updateByIdWithOptions
=
function
(
condition
,
entity
,
options
,
callback
)
{
ForumThread
.
findOneAndUpdate
(
condition
,
entity
,
options
,
function
(
err
,
result
)
{
if
(
err
)
{
console
.
error
(
err
);
callback
(
err
,
null
);
}
else
{
callback
(
null
,
null
);
}
});
};
\ No newline at end of file
app/service/forumUserService.js
View file @
8efcbaec
This diff is collapsed.
Click to expand it.
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