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
fb5f5398
Commit
fb5f5398
authored
Apr 08, 2016
by
strong
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'newfunc_0321_personal_site'
parents
f38031f8
c1ec3b80
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
4 deletions
+45
-4
forumInfo.js
app/controllers/mobile/forumInfo.js
+44
-3
forumThread.js
app/controllers/mobile/forumThread.js
+1
-1
No files found.
app/controllers/mobile/forumInfo.js
View file @
fb5f5398
...
...
@@ -495,8 +495,23 @@ router.get('/info/myThreads', function(req, res, next) {
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
//判断是否已经点赞
util
.
loadLevel
(
req
.
session
.
user
.
ent_code
,
results
.
items
,
function
()
{
res
.
json
(
_
.
assign
(
results
,
returnCode
.
SUCCESS
));
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
));
});
});
}
...
...
@@ -854,7 +869,6 @@ router.get('/info/list/allWithThreadCount', function(req, res, next) {
if
(
infos
[
i
].
toObject
)
{
infos
[
i
]
=
infos
[
i
].
toObject
();
}
console
.
log
(
count
);
infos
[
i
].
favor_by
=
count
;
cont
(
null
,
info
);
}
...
...
@@ -1030,6 +1044,34 @@ router.get('/info/getUserFavorInfo', function(req, res, next) {
callback
(
err
,
datas
.
items
);
});
},
function
(
infos
,
callback
)
{
//获取关注数
var
asyncTasks
=
[];
_
.
forEach
(
infos
,
function
(
info
,
i
)
{
asyncTasks
.
push
(
function
(
cont
)
{
var
conditions
=
{
ent_code
:
ent_code
,
info
:
info
.
_id
};
forumFollowInfoService
.
count
(
conditions
,
function
(
err
,
count
)
{
if
(
err
)
{
console
.
error
(
err
);
cont
(
err
,
null
);
}
else
{
if
(
infos
[
i
].
toObject
)
{
infos
[
i
]
=
infos
[
i
].
toObject
();
}
infos
[
i
].
favor_by
=
count
;
cont
(
null
,
info
);
}
});
});
});
then
.
parallel
(
asyncTasks
).
then
(
function
(
cont
,
datas
)
{
callback
(
null
,
infos
);
}).
fail
(
function
(
err
,
cont
)
{
callback
(
err
,
null
);
});
},
function
(
infos
,
callback
)
{
//获取用户
var
asyncTasks
=
[];
_
.
forEach
(
infos
,
function
(
info
,
i
)
{
...
...
@@ -1056,7 +1098,6 @@ router.get('/info/getUserFavorInfo', function(req, res, next) {
if
(
infos
[
i
].
toObject
)
{
infos
[
i
]
=
infos
[
i
].
toObject
();
}
infos
[
i
].
favor_by
=
infos
[
i
].
favor_by
.
length
;
infos
[
i
].
threadCount
=
count
;
cont
(
null
,
info
);
}
...
...
app/controllers/mobile/forumThread.js
View file @
fb5f5398
...
...
@@ -2339,7 +2339,7 @@ router.get('/thread/getUserFavorThread/:type', function(req, res, next) {
conditions
[
'event.eventStartTime'
]
=
{
$lte
:
today
};
}
queryThread
(
conditions
,
pageNo
,
pageSize
,
null
,
function
(
err
,
results
){
queryThread
(
conditions
,
pageNo
,
pageSize
,
'-created'
,
function
(
err
,
results
){
if
(
err
){
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
...
...
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