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
cd4e4ee8
Commit
cd4e4ee8
authored
Jun 16, 2016
by
刘文胜
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'remotes/origin/remould_0614_thumbup' into SANDBOX
parents
c3e2fba3
88af34a5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
5 deletions
+61
-5
forumAboutMe.js
app/controllers/mobile/forumAboutMe.js
+61
-5
No files found.
app/controllers/mobile/forumAboutMe.js
View file @
cd4e4ee8
...
...
@@ -6,7 +6,7 @@ var express = require('express'),
returnCode
=
require
(
'../../utils/returnCode'
),
_
=
require
(
'lodash'
);
var
forumAboutMEService
=
require
(
'../../service/forumAboutMEService'
);
var
redisPraiseLog
=
require
(
'../../utils/redisPraiseLog'
);
module
.
exports
=
function
(
app
)
{
app
.
use
(
'/v1/forum'
,
router
);
...
...
@@ -17,14 +17,40 @@ router.get('/aboutme/me2other', function(req, res, next) {
var
entcode
=
req
.
session
.
user
.
ent_code
;
var
pageNo
=
req
.
query
.
pageNo
||
1
;
var
pageSize
=
req
.
query
.
pageSize
||
10
;
console
.
log
(
userId
);
console
.
log
(
entcode
);
forumAboutMEService
.
me2other
(
entcode
,
userId
,
pageNo
,
pageSize
,
function
(
err
,
result
)
{
if
(
err
)
{
res
.
json
(
returnCode
.
UNCHECK_ERROR
(
err
));
}
else
{
//判断是否需要加载是否点赞
var
doGETPraise
=
false
;
_
.
forEach
(
result
.
items
,
function
(
d
,
i
)
{
if
(
d
.
type
===
1
&&
d
.
thread
){
//只有帖子需要
doGETPraise
=
true
;
}
});
if
(
!
doGETPraise
){
util
.
loadLevel
(
req
.
session
.
user
.
ent_code
,
result
.
items
,
function
(){
res
.
json
(
_
.
assign
(
result
,
returnCode
.
SUCCESS
));
});
}
util
.
loadLevel
(
req
.
session
.
user
.
ent_code
,
result
.
items
,
function
(){
res
.
json
(
_
.
assign
(
result
,
returnCode
.
SUCCESS
));
redisPraiseLog
.
get
(
ent_code
,
user
.
getMobileUser
(
req
),
'thread'
,
function
(
error
,
docs
)
{
_
.
forEach
(
result
.
items
,
function
(
d
,
i
)
{
if
(
d
.
type
===
1
&&
d
.
thread
){
//只有帖子需要
if
(
result
.
items
[
i
].
toObject
)
{
result
.
items
[
i
]
=
result
.
items
[
i
].
toObject
();
}
result
.
items
[
i
].
thread
.
isPraise
=
false
;
for
(
var
k
=
docs
.
length
-
1
;
k
>=
0
;
k
--
)
{
if
(
result
.
items
[
i
].
thread
.
_id
==
docs
[
k
])
{
result
.
items
[
i
].
thread
.
isPraise
=
true
;
break
;
}
};
}
});
res
.
json
(
_
.
assign
(
result
,
returnCode
.
SUCCESS
));
});
});
}
});
...
...
@@ -74,7 +100,37 @@ router.get('/aboutme/he2other/:id/:entcode', function(req, res, next) {
if
(
err
)
{
res
.
json
(
returnCode
.
UNCHECK_ERROR
(
err
));
}
else
{
res
.
json
(
_
.
assign
(
result
,
returnCode
.
SUCCESS
));
//判断是否需要加载是否点赞
var
doGETPraise
=
false
;
_
.
forEach
(
result
.
items
,
function
(
d
,
i
)
{
if
(
d
.
type
===
1
&&
d
.
thread
){
//只有帖子需要
doGETPraise
=
true
;
}
});
if
(
!
doGETPraise
){
util
.
loadLevel
(
req
.
session
.
user
.
ent_code
,
result
.
items
,
function
(){
res
.
json
(
_
.
assign
(
result
,
returnCode
.
SUCCESS
));
});
}
util
.
loadLevel
(
req
.
session
.
user
.
ent_code
,
result
.
items
,
function
(){
redisPraiseLog
.
get
(
ent_code
,
user
.
getMobileUser
(
req
),
'thread'
,
function
(
error
,
docs
)
{
_
.
forEach
(
result
.
items
,
function
(
d
,
i
)
{
if
(
d
.
type
===
1
&&
d
.
thread
){
//只有帖子需要
if
(
result
.
items
[
i
].
toObject
)
{
result
.
items
[
i
]
=
result
.
items
[
i
].
toObject
();
}
result
.
items
[
i
].
thread
.
isPraise
=
false
;
for
(
var
k
=
docs
.
length
-
1
;
k
>=
0
;
k
--
)
{
if
(
result
.
items
[
i
].
thread
.
_id
==
docs
[
k
])
{
result
.
items
[
i
].
thread
.
isPraise
=
true
;
break
;
}
};
}
});
res
.
json
(
_
.
assign
(
result
,
returnCode
.
SUCCESS
));
});
});
}
});
});
...
...
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