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
5a5356b8
Commit
5a5356b8
authored
Sep 16, 2015
by
strong
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '0911_AboutMe'
parents
2bc7339e
d216a1d9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
69 additions
and
5 deletions
+69
-5
forumThread.js
app/controllers/mobile/forumThread.js
+58
-2
forumAboutMe.js
app/models/forumAboutMe.js
+6
-0
forumAboutMEService.js
app/service/forumAboutMEService.js
+4
-2
forumThreadService.js
app/service/forumThreadService.js
+1
-1
No files found.
app/controllers/mobile/forumThread.js
View file @
5a5356b8
...
@@ -953,10 +953,10 @@ router.post('/thread/:tid/comment/:cid/disable', function(req, res, next) {
...
@@ -953,10 +953,10 @@ router.post('/thread/:tid/comment/:cid/disable', function(req, res, next) {
res
.
json
(
returnCode
.
BUSY
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
}
else
{
if
(
comment
&&
comment
.
level
==
1
){
if
(
comment
&&
comment
.
level
==
1
){
forumAboutMEService
.
updateCommentLevel1Status
(
comment
.
_id
,
comment
.
status
);
forumAboutMEService
.
updateCommentLevel1Status
(
comment
.
_id
,
2
);
}
}
if
(
comment
&&
comment
.
level
==
2
){
if
(
comment
&&
comment
.
level
==
2
){
forumAboutMEService
.
updateCommentLevel2Status
(
comment
.
_id
,
comment
.
status
);
forumAboutMEService
.
updateCommentLevel2Status
(
comment
.
_id
,
2
);
}
}
res
.
json
(
returnCode
.
SUCCESS
);
res
.
json
(
returnCode
.
SUCCESS
);
}
}
...
@@ -1053,6 +1053,62 @@ router.get('/thread/:tid/comment/list', function(req, res, next) {
...
@@ -1053,6 +1053,62 @@ router.get('/thread/:tid/comment/list', function(req, res, next) {
}
}
});
});
router
.
get
(
'/thread/:tid/comment/list/byFloor'
,
function
(
req
,
res
,
next
)
{
var
tid
=
req
.
params
.
tid
||
null
;
var
floor
=
req
.
query
.
floor
||
1
;
// var conditions = {
// ent_code: req.session.user.ent_code,
// thread: tid,
// level: '1',
// status:1
// };
var
countConditions
=
{
ent_code
:
req
.
session
.
user
.
ent_code
,
thread
:
tid
,
level
:
'1'
};
var
conditions
=
{
ent_code
:
req
.
session
.
user
.
ent_code
,
thread
:
tid
,
level
:
'1'
,
floor
:
{
'$gte'
:
floor
-
9
,
'$lte'
:
floor
}
};
//conditions.floor['$lte'] = 12;
if
(
tid
)
{
//获取最新5条评论
forumCommentService
.
count
(
countConditions
,
function
(
err
,
count
)
{
if
(
err
)
{
console
.
log
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
forumCommentService
.
getAllComment
(
conditions
,
1
,
10
,
function
(
err
,
results
)
{
if
(
err
)
{
console
.
log
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
results
.
total
=
count
;
res
.
json
(
_
.
assign
(
results
,
returnCode
.
SUCCESS
));
}
});
}
});
}
else
{
res
.
json
(
returnCode
.
WRONG_PARAM
);
}
});
//评论点赞
//评论点赞
router
.
post
(
'/thread/:tid/comment/:cid/raise'
,
function
(
req
,
res
,
next
)
{
router
.
post
(
'/thread/:tid/comment/:cid/raise'
,
function
(
req
,
res
,
next
)
{
var
userId
=
req
.
session
.
mobileForumUser
.
userId
;
var
userId
=
req
.
session
.
mobileForumUser
.
userId
;
...
...
app/models/forumAboutMe.js
View file @
5a5356b8
...
@@ -23,6 +23,7 @@ var ForumAboutMeSchema = new Schema({
...
@@ -23,6 +23,7 @@ var ForumAboutMeSchema = new Schema({
},
},
type
:{
//分类 1帖子 2一级评论 3二级评论
type
:{
//分类 1帖子 2一级评论 3二级评论
type
:
Number
,
type
:
Number
,
index
:
true
,
require
:
true
,
require
:
true
,
default
:
0
default
:
0
},
},
...
@@ -50,6 +51,11 @@ var ForumAboutMeSchema = new Schema({
...
@@ -50,6 +51,11 @@ var ForumAboutMeSchema = new Schema({
index
:
true
,
index
:
true
,
ref
:
'ForumComment'
ref
:
'ForumComment'
},
},
commentLevel2ThreadFrom
:{
//二级评论对应的帖子的发帖人
type
:
Schema
.
Types
.
ObjectId
,
require
:
false
,
ref
:
'ForumUser'
},
commentLevel2Status
:{
commentLevel2Status
:{
type
:
Number
type
:
Number
},
},
...
...
app/service/forumAboutMEService.js
View file @
5a5356b8
...
@@ -53,6 +53,7 @@ exports.saveCommentLevel2=function(tid,commentLevel1,commentLevel2){
...
@@ -53,6 +53,7 @@ exports.saveCommentLevel2=function(tid,commentLevel1,commentLevel2){
commentLevel1
:
commentLevel1
.
_id
,
commentLevel1
:
commentLevel1
.
_id
,
commentLevel1Status
:
commentLevel1
.
status
,
commentLevel1Status
:
commentLevel1
.
status
,
commentLevel2
:
commentLevel2
.
_id
,
commentLevel2
:
commentLevel2
.
_id
,
commentLevel2ThreadFrom
:
thread
.
from
,
commentLevel2Status
:
commentLevel2
.
status
,
commentLevel2Status
:
commentLevel2
.
status
,
created
:
new
Date
()
created
:
new
Date
()
});
});
...
@@ -87,6 +88,7 @@ exports.saveCommentLevel2BySearch=function(tid,l1id,l2id){
...
@@ -87,6 +88,7 @@ exports.saveCommentLevel2BySearch=function(tid,l1id,l2id){
commentLevel1
:
commentLevel1
.
_id
,
commentLevel1
:
commentLevel1
.
_id
,
commentLevel1Status
:
commentLevel1
.
status
,
commentLevel1Status
:
commentLevel1
.
status
,
commentLevel2
:
commentLevel2
.
_id
,
commentLevel2
:
commentLevel2
.
_id
,
commentLevel2ThreadFrom
:
thread
.
from
,
commentLevel2Status
:
commentLevel2
.
status
,
commentLevel2Status
:
commentLevel2
.
status
,
created
:
new
Date
()
created
:
new
Date
()
});
});
...
@@ -201,7 +203,7 @@ exports.me2other=function(ent_code,id,pageNo,pageSize,callback){
...
@@ -201,7 +203,7 @@ exports.me2other=function(ent_code,id,pageNo,pageSize,callback){
var
limit
=
count
-
skip
>
pageSize
?
pageSize
:
(
count
-
skip
);
var
limit
=
count
-
skip
>
pageSize
?
pageSize
:
(
count
-
skip
);
var
sortBy
=
'-created'
;
var
sortBy
=
'-created'
;
ForumAboutMe
.
find
(
condition
).
populate
({
ForumAboutMe
.
find
(
condition
).
populate
({
path
:
'from to'
,
path
:
'from to
commentLevel2ThreadFrom
'
,
select
:
'uid nickName icon displayName displayIcon classLevel'
select
:
'uid nickName icon displayName displayIcon classLevel'
}).
populate
({
}).
populate
({
path
:
'thread'
,
path
:
'thread'
,
...
@@ -245,7 +247,7 @@ exports.other2me=function(ent_code,id,pageNo,pageSize,callback){
...
@@ -245,7 +247,7 @@ exports.other2me=function(ent_code,id,pageNo,pageSize,callback){
var
limit
=
count
-
skip
>
pageSize
?
pageSize
:
(
count
-
skip
);
var
limit
=
count
-
skip
>
pageSize
?
pageSize
:
(
count
-
skip
);
var
sortBy
=
'-created'
;
var
sortBy
=
'-created'
;
ForumAboutMe
.
find
(
condition
).
populate
({
ForumAboutMe
.
find
(
condition
).
populate
({
path
:
'from to'
,
path
:
'from to
commentLevel2ThreadFrom
'
,
select
:
'uid nickName icon displayName displayIcon classLevel'
select
:
'uid nickName icon displayName displayIcon classLevel'
}).
populate
({
}).
populate
({
path
:
'thread'
,
path
:
'thread'
,
...
...
app/service/forumThreadService.js
View file @
5a5356b8
...
@@ -250,7 +250,7 @@ exports.getThreadById = function(tid, callback) {
...
@@ -250,7 +250,7 @@ exports.getThreadById = function(tid, callback) {
var
hotPhotos
=
results
[
4
]
||
[];
//最热照片墙列表
var
hotPhotos
=
results
[
4
]
||
[];
//最热照片墙列表
var
canyuPeopleCount
=
results
[
5
]
||
0
;
//参与人数
var
canyuPeopleCount
=
results
[
5
]
||
0
;
//参与人数
var
threadObj
=
thread
.
toObject
()
;
var
threadObj
=
thread
&&
thread
.
toObject
()
||
{}
;
threadObj
.
comments
=
comments
;
threadObj
.
comments
=
comments
;
threadObj
.
subThreads
=
subThreads
;
threadObj
.
subThreads
=
subThreads
;
threadObj
.
latestPhotos
=
latestPhotos
;
threadObj
.
latestPhotos
=
latestPhotos
;
...
...
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