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
634b8020
Commit
634b8020
authored
Apr 14, 2016
by
陈家荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新屏蔽文章的状态
parent
80a3d60a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
15 deletions
+24
-15
forumThread.js
app/controllers/mobile/forumThread.js
+12
-3
forumThreadService.js
app/service/forumThreadService.js
+12
-12
No files found.
app/controllers/mobile/forumThread.js
View file @
634b8020
...
@@ -1896,7 +1896,7 @@ router.get('/thread/:tid/hotPhotos', function(req, res, next) {
...
@@ -1896,7 +1896,7 @@ router.get('/thread/:tid/hotPhotos', function(req, res, next) {
});
});
//
逻辑删除
文章
//
屏蔽
文章
router
.
post
(
'/thread/:tid/disable'
,
function
(
req
,
res
,
next
)
{
router
.
post
(
'/thread/:tid/disable'
,
function
(
req
,
res
,
next
)
{
var
user_id
=
user
.
getMobileUser
(
req
);
var
user_id
=
user
.
getMobileUser
(
req
);
var
tid
=
req
.
params
.
tid
;
var
tid
=
req
.
params
.
tid
;
...
@@ -1904,11 +1904,20 @@ router.post('/thread/:tid/disable', function(req, res, next) {
...
@@ -1904,11 +1904,20 @@ router.post('/thread/:tid/disable', function(req, res, next) {
forumThreadService
.
getThreadById
(
tid
,
function
(
err
,
thread
)
{
forumThreadService
.
getThreadById
(
tid
,
function
(
err
,
thread
)
{
if
(
thread
.
from
&&
user_id
)
{
if
(
thread
.
from
&&
user_id
)
{
if
(
thread
.
from
.
_id
.
toString
()
==
user_id
.
toString
())
{
if
(
thread
.
from
.
_id
.
toString
()
==
user_id
.
toString
())
{
forumThreadService
.
logicDeleteThreadById
(
tid
,
function
(
err
,
flag
)
{
// 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
)
{
if
(
err
)
{
if
(
err
)
{
res
.
json
(
returnCode
.
BUSY
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
}
else
{
forumAboutMEService
.
updateThreadStatus
(
tid
,
3
);
forumAboutMEService
.
updateThreadStatus
(
tid
,
0
);
res
.
json
(
returnCode
.
SUCCESS
);
res
.
json
(
returnCode
.
SUCCESS
);
}
}
});
});
...
...
app/service/forumThreadService.js
View file @
634b8020
...
@@ -634,18 +634,6 @@ exports.updateThreadById = function(tid, entity, callback) {
...
@@ -634,18 +634,6 @@ exports.updateThreadById = function(tid, entity, callback) {
//逻辑删除文章
//逻辑删除文章
exports
.
logicDeleteThreadById
=
function
(
tid
,
callback
)
{
exports
.
logicDeleteThreadById
=
function
(
tid
,
callback
)
{
// ForumThread.update({
// _id: mongoose.Types.ObjectId(tid)
// }, {
// status : 3
// }, null, function(err, result) {
// if (err) {
// console.error(err);
// callback(err, false);
// } else {
// callback(null, true);
// }
// });
findOneAndUpdate
({
_id
:
mongoose
.
Types
.
ObjectId
(
tid
)},
{
status
:
3
},
'updateRedisRecommentThreads'
,
function
(
err
,
result
)
{
findOneAndUpdate
({
_id
:
mongoose
.
Types
.
ObjectId
(
tid
)},
{
status
:
3
},
'updateRedisRecommentThreads'
,
function
(
err
,
result
)
{
if
(
err
)
{
if
(
err
)
{
console
.
error
(
err
);
console
.
error
(
err
);
...
@@ -656,6 +644,18 @@ exports.logicDeleteThreadById = function(tid, callback) {
...
@@ -656,6 +644,18 @@ exports.logicDeleteThreadById = function(tid, callback) {
});
});
};
};
//更新文章
exports
.
updateThread
=
function
(
tid
,
entity
,
callback
)
{
findOneAndUpdate
({
_id
:
mongoose
.
Types
.
ObjectId
(
tid
)},
entity
,
'updateRedisRecommentThreads'
,
function
(
err
,
result
)
{
if
(
err
)
{
console
.
error
(
err
);
callback
(
err
,
false
);
}
else
{
callback
(
null
,
true
);
}
});
};
//根据ID删除文章
//根据ID删除文章
exports
.
deleteThreadById
=
function
(
tid
,
callback
)
{
exports
.
deleteThreadById
=
function
(
tid
,
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