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
6d59361f
Commit
6d59361f
authored
Mar 05, 2016
by
strong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加手机端系统消息清空功能。
parent
943e8539
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
10 deletions
+35
-10
forumMessage.js
app/controllers/mobile/forumMessage.js
+22
-3
forumMessageService.js
app/service/forumMessageService.js
+13
-7
No files found.
app/controllers/mobile/forumMessage.js
View file @
6d59361f
...
...
@@ -155,8 +155,8 @@ router.post('/message/:mid/unShowMsg', function(req, res, next) {
var
mid
=
req
.
params
.
mid
||
null
;
var
userID
=
user
.
getMobileUser
(
req
);
if
(
mid
&&
userID
){
//更新用户的消息状态为未读
forumMessageService
.
updateUserMessageStatus
({
_id
:
userID
},
mid
,
2
,
function
(
err
,
result
)
{
//更新用户的消息状态为未读
forumMessageService
.
updateUserMessageStatus
({
_id
:
userID
},
mid
,
2
,
function
(
err
,
result
)
{
if
(
err
)
{
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
...
...
@@ -165,6 +165,25 @@ router.post('/message/:mid/unShowMsg', function(req, res, next) {
}
});
}
else
{
res
.
json
(
returnCode
.
WRONG_PARAM
);
res
.
json
(
returnCode
.
WRONG_PARAM
);
}
});
//用户清空消息(修改状态)
router
.
post
(
'/message/cleanAll'
,
function
(
req
,
res
,
next
)
{
//消息参数
var
userID
=
user
.
getMobileUser
(
req
);
if
(
userID
){
//更新用户的消息状态为未读
forumMessageService
.
updateUserMessageStatus
({
_id
:
userID
},
null
,
2
,
function
(
err
,
result
)
{
if
(
err
)
{
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
res
.
json
(
returnCode
.
SUCCESS
);
}
});
}
else
{
res
.
json
(
returnCode
.
WRONG_PARAM
);
}
});
\ No newline at end of file
app/service/forumMessageService.js
View file @
6d59361f
...
...
@@ -210,14 +210,20 @@ exports.updateUserMessageStatus= function(condition,msgID, status,callback) {
console
.
error
(
err
);
callback
(
err
,
null
);
}
else
{
for
(
var
i
in
docs
){
if
(
docs
[
i
].
msg
==
msgID
)
{
if
(
docs
[
i
].
toObject
)
{
docs
[
i
]
=
docs
[
i
].
toObject
();
if
(
!
msgID
){
for
(
var
i
in
docs
){
docs
[
i
].
status
=
status
;
}
}
else
{
for
(
var
i
in
docs
){
if
(
docs
[
i
].
msg
==
msgID
)
{
if
(
docs
[
i
].
toObject
)
{
docs
[
i
]
=
docs
[
i
].
toObject
();
}
docs
[
i
].
status
=
status
;
break
;
}
docs
[
i
].
status
=
status
;
break
;
}
}
}
//更新用户
ForumUser
.
update
(
condition
,
{
messages
:
docs
},
null
,
function
(
err
,
result
){
...
...
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