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
b4769a4a
Commit
b4769a4a
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
cd4e4ee8
5eaf6846
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
62 deletions
+21
-62
forumAboutMe.js
app/controllers/mobile/forumAboutMe.js
+5
-61
forumInfo.js
app/controllers/mobile/forumInfo.js
+16
-1
No files found.
app/controllers/mobile/forumAboutMe.js
View file @
b4769a4a
...
@@ -6,7 +6,7 @@ var express = require('express'),
...
@@ -6,7 +6,7 @@ var express = require('express'),
returnCode
=
require
(
'../../utils/returnCode'
),
returnCode
=
require
(
'../../utils/returnCode'
),
_
=
require
(
'lodash'
);
_
=
require
(
'lodash'
);
var
forumAboutMEService
=
require
(
'../../service/forumAboutMEService'
);
var
forumAboutMEService
=
require
(
'../../service/forumAboutMEService'
);
var
redisPraiseLog
=
require
(
'../../utils/redisPraiseLog'
);
module
.
exports
=
function
(
app
)
{
module
.
exports
=
function
(
app
)
{
app
.
use
(
'/v1/forum'
,
router
);
app
.
use
(
'/v1/forum'
,
router
);
...
@@ -17,42 +17,16 @@ router.get('/aboutme/me2other', function(req, res, next) {
...
@@ -17,42 +17,16 @@ router.get('/aboutme/me2other', function(req, res, next) {
var
entcode
=
req
.
session
.
user
.
ent_code
;
var
entcode
=
req
.
session
.
user
.
ent_code
;
var
pageNo
=
req
.
query
.
pageNo
||
1
;
var
pageNo
=
req
.
query
.
pageNo
||
1
;
var
pageSize
=
req
.
query
.
pageSize
||
10
;
var
pageSize
=
req
.
query
.
pageSize
||
10
;
console
.
log
(
userId
);
console
.
log
(
entcode
);
forumAboutMEService
.
me2other
(
entcode
,
userId
,
pageNo
,
pageSize
,
function
(
err
,
result
)
{
forumAboutMEService
.
me2other
(
entcode
,
userId
,
pageNo
,
pageSize
,
function
(
err
,
result
)
{
if
(
err
)
{
if
(
err
)
{
res
.
json
(
returnCode
.
UNCHECK_ERROR
(
err
));
res
.
json
(
returnCode
.
UNCHECK_ERROR
(
err
));
}
else
{
}
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
(){
util
.
loadLevel
(
req
.
session
.
user
.
ent_code
,
result
.
items
,
function
(){
res
.
json
(
_
.
assign
(
result
,
returnCode
.
SUCCESS
));
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
));
});
});
}
});
});
});
});
...
@@ -100,37 +74,7 @@ router.get('/aboutme/he2other/:id/:entcode', function(req, res, next) {
...
@@ -100,37 +74,7 @@ router.get('/aboutme/he2other/:id/:entcode', function(req, res, next) {
if
(
err
)
{
if
(
err
)
{
res
.
json
(
returnCode
.
UNCHECK_ERROR
(
err
));
res
.
json
(
returnCode
.
UNCHECK_ERROR
(
err
));
}
else
{
}
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
(){
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
));
res
.
json
(
_
.
assign
(
result
,
returnCode
.
SUCCESS
));
});
});
}
}
});
});
});
});
...
...
app/controllers/mobile/forumInfo.js
View file @
b4769a4a
...
@@ -562,9 +562,24 @@ router.get('/info/hisThreads/:id', function(req, res, next) {
...
@@ -562,9 +562,24 @@ router.get('/info/hisThreads/:id', function(req, res, next) {
console
.
error
(
err
);
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
}
else
{
//判断是否已经点赞
util
.
loadLevel
(
req
.
session
.
user
.
ent_code
,
results
.
items
,
function
()
{
util
.
loadLevel
(
req
.
session
.
user
.
ent_code
,
results
.
items
,
function
()
{
redisPraiseLog
.
get
(
req
.
session
.
user
.
ent_code
,
user
.
getMobileUser
(
req
),
'thread'
,
function
(
error
,
docs
)
{
_
.
forEach
(
results
.
items
,
function
(
d
,
i
)
{
if
(
results
.
items
[
i
].
toObject
)
{
results
.
items
[
i
]
=
results
.
items
[
i
].
toObject
();
}
results
.
items
[
i
].
isPraise
=
false
;
for
(
var
k
=
docs
.
length
-
1
;
k
>=
0
;
k
--
)
{
if
(
results
.
items
[
i
].
_id
==
docs
[
k
])
{
results
.
items
[
i
].
isPraise
=
true
;
break
;
}
};
});
res
.
json
(
_
.
assign
(
results
,
returnCode
.
SUCCESS
));
res
.
json
(
_
.
assign
(
results
,
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