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
6867bbc2
Commit
6867bbc2
authored
Apr 14, 2016
by
陈家荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新社区帖子查询
parent
bd7ea502
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
13 deletions
+46
-13
forumThread.js
app/controllers/mobile/forumThread.js
+1
-10
forumThreadService.js
app/service/forumThreadService.js
+45
-3
No files found.
app/controllers/mobile/forumThread.js
View file @
6867bbc2
...
...
@@ -1904,16 +1904,7 @@ router.post('/thread/:tid/disable', function(req, res, next) {
forumThreadService
.
getThreadById
(
tid
,
function
(
err
,
thread
)
{
if
(
thread
.
from
&&
user_id
)
{
if
(
thread
.
from
.
_id
.
toString
()
==
user_id
.
toString
())
{
// forumThreadService.logicDeleteThreadById(tid, function(err, flag) {
// if (err) {
// res.json(returnCode.BUSY);
// } else {
// forumAboutMEService.updateThreadStatus(tid, 3);
// res.json(returnCode.SUCCESS);
// }
// });
forumThreadService
.
updateThread
(
tid
,
{
status
:
0
},
function
(
err
,
flag
)
{
forumThreadService
.
updateThreadById_2
(
tid
,
{
status
:
0
},
function
(
err
,
flag
)
{
if
(
err
)
{
res
.
json
(
returnCode
.
BUSY
);
}
else
{
...
...
app/service/forumThreadService.js
View file @
6867bbc2
...
...
@@ -645,8 +645,8 @@ exports.logicDeleteThreadById = function(tid, callback) {
};
//更新文章
exports
.
updateThread
=
function
(
tid
,
entity
,
callback
)
{
findOneAndUpdate
({
_id
:
mongoose
.
Types
.
ObjectId
(
tid
)
},
entity
,
'updateRedisRecommentThreads'
,
function
(
err
,
result
)
{
exports
.
updateThread
ById_2
=
function
(
tid
,
entity
,
callback
)
{
findOneAndUpdate
({
_id
:
tid
},
entity
,
'updateRedisRecommentThreads'
,
function
(
err
,
result
)
{
if
(
err
)
{
console
.
error
(
err
);
callback
(
err
,
false
);
...
...
@@ -814,6 +814,48 @@ function getSubThreads(doc, sort, callback) {
});
}
//获取话题、照片墙子文章数据
function
getMobileSubThreads
(
doc
,
sort
,
callback
)
{
var
conditions
=
{
pid
:
doc
.
_id
,
status
:
1
,
level
:
2
,
ent_code
:
doc
.
ent_code
};
var
sortBy
=
'-top -quality -created'
;
if
(
sort
)
{
sortBy
=
sort
;
}
ForumThread
.
find
(
conditions
,
subThreadFields
).
populate
(
'from'
,
'icon'
).
sort
(
sortBy
).
exec
(
function
(
err
,
docs
)
{
if
(
err
)
{
console
.
error
(
err
);
callback
(
err
,
null
);
}
else
{
var
list
=
[];
//用户去重
_
.
forEach
(
docs
,
function
(
one
,
i
)
{
var
flag
=
true
;
_
.
forEach
(
list
,
function
(
two
,
k
)
{
if
(
one
.
from
.
_id
==
two
.
from
.
_id
){
flag
=
false
;
}
});
if
(
flag
){
list
.
push
(
one
);
}
});
var
obj
=
{};
obj
.
docTotal
=
docs
.
length
;
obj
.
total
=
list
.
length
;
obj
.
items
=
list
;
var
newDoc
=
doc
.
toObject
();
newDoc
.
subThreads
=
obj
;
callback
(
null
,
newDoc
);
}
});
}
function
getAllThreadByFidHelp
(
conditions
,
pageNo
,
pageSize
,
sort
,
callback
)
{
countAllByFid
(
conditions
,
function
(
err
,
count
)
{
if
(
err
)
{
...
...
@@ -1412,7 +1454,7 @@ exports.getThreadWithNotPopulateComment = function(conditions, pageNo, pageSize,
});
}
else
{
asyncTasks
.
push
(
function
(
callback
)
{
getSubThreads
(
doc
,
null
,
callback
);
get
Mobile
SubThreads
(
doc
,
null
,
callback
);
});
}
});
...
...
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