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
9c72a803
Commit
9c72a803
authored
Mar 25, 2015
by
张淼
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
f65d652c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
17 deletions
+17
-17
forumThread.js
app/controllers/mobile/forumThread.js
+17
-17
No files found.
app/controllers/mobile/forumThread.js
View file @
9c72a803
...
@@ -29,7 +29,7 @@ module.exports = function(app) {
...
@@ -29,7 +29,7 @@ module.exports = function(app) {
router
.
post
(
'/thread/create'
,
function
(
req
,
res
,
next
)
{
router
.
post
(
'/thread/create'
,
function
(
req
,
res
,
next
)
{
var
rs
=
{};
var
rs
=
{};
req
.
body
.
ent_code
=
req
.
session
.
user
.
ent_code
;
req
.
body
.
ent_code
=
req
.
session
.
user
.
ent_code
;
req
.
body
.
from
=
user
.
getMobileUser
();
req
.
body
.
from
=
user
.
getMobileUser
(
req
);
// console.log(req.body);
// console.log(req.body);
//-----------处理前端上传图片开始
//-----------处理前端上传图片开始
...
@@ -163,7 +163,7 @@ router.post('/thread/:tid/raise', function(req, res, next) {
...
@@ -163,7 +163,7 @@ router.post('/thread/:tid/raise', function(req, res, next) {
var
exp
=
req
.
session
.
openUser
.
exp
||
0
;
var
exp
=
req
.
session
.
openUser
.
exp
||
0
;
//判断是否已经点赞
//判断是否已经点赞
forumPraiseLogService
.
queryPraiseLog
(
tid
,
null
,
user
.
getMobileUser
(),
1
,
function
(
err
,
logs
){
forumPraiseLogService
.
queryPraiseLog
(
tid
,
null
,
user
.
getMobileUser
(
req
),
1
,
function
(
err
,
logs
){
if
(
err
){
if
(
err
){
res
.
json
(
returnCode
.
BUSY
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
}
else
{
...
@@ -199,7 +199,7 @@ router.post('/thread/:tid/raise', function(req, res, next) {
...
@@ -199,7 +199,7 @@ router.post('/thread/:tid/raise', function(req, res, next) {
function
(
callback
){
function
(
callback
){
var
entity
=
{
var
entity
=
{
ent_code
:
req
.
session
.
user
.
ent_code
,
ent_code
:
req
.
session
.
user
.
ent_code
,
user
:
user
.
getMobileUser
(),
user
:
user
.
getMobileUser
(
req
),
thread
:
tid
,
thread
:
tid
,
ip
:
req
.
ip
,
ip
:
req
.
ip
,
comment
:
null
,
comment
:
null
,
...
@@ -218,7 +218,7 @@ router.post('/thread/:tid/raise', function(req, res, next) {
...
@@ -218,7 +218,7 @@ router.post('/thread/:tid/raise', function(req, res, next) {
console
.
error
(
err
);
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
}
else
{
httpService
.
sendRequest
(
req
.
session
.
user
.
ent_code
,
user
.
getOpenId
(
)
,
tid
,
'raise'
);
httpService
.
sendRequest
(
req
.
session
.
user
.
ent_code
,
user
.
getOpenId
(
req
,
tid
,
'raise'
);
forumThreadService
.
getThreadById
(
tid
,
function
(
err
,
doc
){
forumThreadService
.
getThreadById
(
tid
,
function
(
err
,
doc
){
if
(
err
){
if
(
err
){
console
.
error
(
err
);
console
.
error
(
err
);
...
@@ -283,7 +283,7 @@ router.post('/thread/:tid/share', function(req, res, next) {
...
@@ -283,7 +283,7 @@ router.post('/thread/:tid/share', function(req, res, next) {
function
(
callback
){
function
(
callback
){
var
entity
=
{
var
entity
=
{
ent_code
:
req
.
session
.
user
.
ent_code
,
ent_code
:
req
.
session
.
user
.
ent_code
,
user
:
user
.
getMobileUser
(),
user
:
user
.
getMobileUser
(
req
),
thread
:
tid
,
thread
:
tid
,
destination
:
destination
,
destination
:
destination
,
ip
:
req
.
ip
ip
:
req
.
ip
...
@@ -302,7 +302,7 @@ router.post('/thread/:tid/share', function(req, res, next) {
...
@@ -302,7 +302,7 @@ router.post('/thread/:tid/share', function(req, res, next) {
console
.
error
(
err
);
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
}
else
{
httpService
.
sendRequest
(
req
.
session
.
user
.
ent_code
,
user
.
getOpenId
(),
tid
,
'share'
);
httpService
.
sendRequest
(
req
.
session
.
user
.
ent_code
,
user
.
getOpenId
(
req
),
tid
,
'share'
);
res
.
json
(
returnCode
.
SUCCESS
);
res
.
json
(
returnCode
.
SUCCESS
);
}
}
});
});
...
@@ -351,7 +351,7 @@ router.post('/thread/:tid/comment/create', function(req, res, next) {
...
@@ -351,7 +351,7 @@ router.post('/thread/:tid/comment/create', function(req, res, next) {
function
(
callback
){
function
(
callback
){
var
entity
=
{
var
entity
=
{
ent_code
:
req
.
session
.
user
.
ent_code
,
ent_code
:
req
.
session
.
user
.
ent_code
,
from
:
user
.
getMobileUser
(),
from
:
user
.
getMobileUser
(
req
),
content
:
content
,
content
:
content
,
ip
:
req
.
ip
,
ip
:
req
.
ip
,
thread
:
thread
,
thread
:
thread
,
...
@@ -401,7 +401,7 @@ router.post('/thread/:tid/comment/create', function(req, res, next) {
...
@@ -401,7 +401,7 @@ router.post('/thread/:tid/comment/create', function(req, res, next) {
console
.
error
(
err
);
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
}
else
{
httpService
.
sendRequest
(
req
.
session
.
user
.
ent_code
,
user
.
getOpenId
(),
tid
,
'comment'
);
httpService
.
sendRequest
(
req
.
session
.
user
.
ent_code
,
user
.
getOpenId
(
req
),
tid
,
'comment'
);
async
.
parallel
([
async
.
parallel
([
function
(
callback
){
function
(
callback
){
//获取最新5条评论
//获取最新5条评论
...
@@ -464,7 +464,7 @@ router.post('/thread/:tid/comment/:cid/create', function(req, res, next) {
...
@@ -464,7 +464,7 @@ router.post('/thread/:tid/comment/:cid/create', function(req, res, next) {
var
integral
=
req
.
session
.
openUser
.
integral
||
0
;
var
integral
=
req
.
session
.
openUser
.
integral
||
0
;
var
exp
=
req
.
session
.
openUser
.
exp
||
0
;
var
exp
=
req
.
session
.
openUser
.
exp
||
0
;
var
destination
=
req
.
body
.
destination
||
'1'
;
var
destination
=
req
.
body
.
destination
||
'1'
;
req
.
body
.
from
=
user
.
getMobileUser
();
req
.
body
.
from
=
user
.
getMobileUser
(
req
);
//1.检查是否有权限
//1.检查是否有权限
forumRolePermissionService
.
checkRolePermiss
(
req
.
session
.
user
.
ent_code
,
'reply'
,
integral
,
exp
,
function
(
err
,
result
){
forumRolePermissionService
.
checkRolePermiss
(
req
.
session
.
user
.
ent_code
,
'reply'
,
integral
,
exp
,
function
(
err
,
result
){
...
@@ -483,7 +483,7 @@ router.post('/thread/:tid/comment/:cid/create', function(req, res, next) {
...
@@ -483,7 +483,7 @@ router.post('/thread/:tid/comment/:cid/create', function(req, res, next) {
function
(
callback
){
function
(
callback
){
var
entity
=
{
var
entity
=
{
ent_code
:
req
.
session
.
user
.
ent_code
,
ent_code
:
req
.
session
.
user
.
ent_code
,
from
:
user
.
getMobileUser
(),
from
:
user
.
getMobileUser
(
req
),
to
:
req
.
body
.
to
,
to
:
req
.
body
.
to
,
content
:
content
,
content
:
content
,
ip
:
req
.
ip
,
ip
:
req
.
ip
,
...
@@ -526,7 +526,7 @@ router.post('/thread/:tid/comment/:cid/create', function(req, res, next) {
...
@@ -526,7 +526,7 @@ router.post('/thread/:tid/comment/:cid/create', function(req, res, next) {
console
.
error
(
err
);
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
}
else
{
httpService
.
sendRequest
(
req
.
session
.
user
.
ent_code
,
user
.
getOpenId
(),
tid
,
'reply'
);
httpService
.
sendRequest
(
req
.
session
.
user
.
ent_code
,
user
.
getOpenId
(
req
),
tid
,
'reply'
);
ForumComment
.
populate
(
results
[
0
],
{
path
:
'from to'
,
select
:
'uid nickName icon comments'
}
,
function
(
err
,
c
){
ForumComment
.
populate
(
results
[
0
],
{
path
:
'from to'
,
select
:
'uid nickName icon comments'
}
,
function
(
err
,
c
){
if
(
err
){
if
(
err
){
res
.
json
(
returnCode
.
BUSY
);
res
.
json
(
returnCode
.
BUSY
);
...
@@ -565,7 +565,7 @@ router.post('/thread/:tid/comment/:cid/delete', function(req, res, next) {
...
@@ -565,7 +565,7 @@ router.post('/thread/:tid/comment/:cid/delete', function(req, res, next) {
res
.
json
(
returnCode
.
BUSY
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
}
else
{
if
(
result
){
if
(
result
){
if
(
result
.
from
===
user
.
getMobileUser
()){
if
(
result
.
from
===
user
.
getMobileUser
(
req
)){
async
.
parallel
([
async
.
parallel
([
function
(
callback
){
function
(
callback
){
forumCommentService
.
deleteCommentById
(
cid
,
function
(
err
,
result
){
forumCommentService
.
deleteCommentById
(
cid
,
function
(
err
,
result
){
...
@@ -633,7 +633,7 @@ router.post('/thread/:tid/comment/:cid/raise', function(req, res, next) {
...
@@ -633,7 +633,7 @@ router.post('/thread/:tid/comment/:cid/raise', function(req, res, next) {
var
integral
=
req
.
session
.
openUser
.
integral
||
0
;
var
integral
=
req
.
session
.
openUser
.
integral
||
0
;
var
exp
=
req
.
session
.
openUser
.
exp
||
0
;
var
exp
=
req
.
session
.
openUser
.
exp
||
0
;
//判断是否已经点赞
//判断是否已经点赞
forumPraiseLogService
.
queryPraiseLog
(
tid
,
cid
,
user
.
getMobileUser
(),
2
,
function
(
err
,
logs
){
forumPraiseLogService
.
queryPraiseLog
(
tid
,
cid
,
user
.
getMobileUser
(
req
),
2
,
function
(
err
,
logs
){
if
(
err
){
if
(
err
){
res
.
json
(
returnCode
.
BUSY
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
}
else
{
...
@@ -665,7 +665,7 @@ router.post('/thread/:tid/comment/:cid/raise', function(req, res, next) {
...
@@ -665,7 +665,7 @@ router.post('/thread/:tid/comment/:cid/raise', function(req, res, next) {
function
(
callback
){
function
(
callback
){
var
entity
=
{
var
entity
=
{
ent_code
:
req
.
session
.
user
.
ent_code
,
ent_code
:
req
.
session
.
user
.
ent_code
,
user
:
user
.
getMobileUser
(),
user
:
user
.
getMobileUser
(
req
),
thread
:
tid
,
thread
:
tid
,
ip
:
req
.
ip
,
ip
:
req
.
ip
,
comment
:
cid
,
comment
:
cid
,
...
@@ -684,7 +684,7 @@ router.post('/thread/:tid/comment/:cid/raise', function(req, res, next) {
...
@@ -684,7 +684,7 @@ router.post('/thread/:tid/comment/:cid/raise', function(req, res, next) {
console
.
error
(
err
);
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
}
else
{
httpService
.
sendRequest
(
req
.
session
.
user
.
ent_code
,
user
.
getOpenId
(),
tid
,
'raise'
);
httpService
.
sendRequest
(
req
.
session
.
user
.
ent_code
,
user
.
getOpenId
(
req
),
tid
,
'raise'
);
//返回点赞总数
//返回点赞总数
forumCommentService
.
getCommentById
(
cid
,
function
(
err
,
doc
){
forumCommentService
.
getCommentById
(
cid
,
function
(
err
,
doc
){
if
(
err
){
if
(
err
){
...
@@ -719,7 +719,7 @@ router.post('/thread/:tid/comment/:cid/raise', function(req, res, next) {
...
@@ -719,7 +719,7 @@ router.post('/thread/:tid/comment/:cid/raise', function(req, res, next) {
router
.
post
(
'/thread/:tid/userShield'
,
function
(
req
,
res
,
next
)
{
router
.
post
(
'/thread/:tid/userShield'
,
function
(
req
,
res
,
next
)
{
var
tid
=
req
.
params
.
tid
||
null
;
var
tid
=
req
.
params
.
tid
||
null
;
if
(
tid
){
if
(
tid
){
forumUserThreadControlService
.
getUserThreadControlById
(
user
.
getMobileUser
(),
function
(
err
,
doc
){
forumUserThreadControlService
.
getUserThreadControlById
(
user
.
getMobileUser
(
req
),
function
(
err
,
doc
){
if
(
err
){
if
(
err
){
res
.
json
(
returnCode
.
BUSY
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
}
else
{
...
@@ -737,7 +737,7 @@ router.post('/thread/:tid/userShield', function(req, res, next) {
...
@@ -737,7 +737,7 @@ router.post('/thread/:tid/userShield', function(req, res, next) {
var
array
=
[
tid
];
var
array
=
[
tid
];
var
entity
=
{
var
entity
=
{
ent_code
:
req
.
session
.
user
.
ent_code
,
ent_code
:
req
.
session
.
user
.
ent_code
,
user
:
user
.
getMobileUser
(),
user
:
user
.
getMobileUser
(
req
),
thread
:
array
thread
:
array
};
};
forumUserThreadControlService
.
createUserThreadControl
(
entity
,
function
(
err
,
result
){
forumUserThreadControlService
.
createUserThreadControl
(
entity
,
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