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
e6711888
Commit
e6711888
authored
Jun 29, 2015
by
陈家荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
22
parent
6341415a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
3 deletions
+22
-3
forumLog.js
app/controllers/admin/forumLog.js
+22
-3
No files found.
app/controllers/admin/forumLog.js
View file @
e6711888
...
...
@@ -68,23 +68,42 @@ router.get('/statistic',function(req, res, next) {
ForumThread
.
count
(
match
,
function
(
err
,
count
){
cont
(
err
,
count
);
});
},
function
(
cont
){
//总访问用户
var
match
=
{
ent_code
:
ent_code
};
aggregate
(
ForumUvLog
,
match
,{
mid
:
'$mid'
},{
'count'
:
-
1
},
function
(
err
,
docs
){
cont
(
err
,
docs
.
length
);
});
},
function
(
cont
){
//总发帖数
var
match
=
{
ent_code
:
ent_code
};
ForumThread
.
count
(
match
,
function
(
err
,
count
){
cont
(
err
,
count
);
});
}
]).
then
(
function
(
cont
,
datas
){
var
y_user
=
datas
[
0
],
by_user
=
datas
[
1
],
y_thread
=
datas
[
2
],
by_thread
=
datas
[
3
];
all_user
=
datas
[
4
];
all_thread
=
datas
[
5
];
//计算昨天比前天多 多少 的百分比
var
user_rate
=
(
by_user
===
0
)?
y_user
:(
y_user
/
by_user
).
toFixed
(
4
)
-
1
,
thread_rate
=
(
by_thread
===
0
)?
y_thread
:(
y_thread
/
by_thread
).
toFixed
(
4
)
-
1
;
cont
(
null
,
y_user
,
user_rate
,
y_thread
,
thread_rate
);
}).
then
(
function
(
cont
,
y_user
,
user_rate
,
y_thread
,
thread_rate
){
cont
(
null
,
y_user
,
user_rate
,
y_thread
,
thread_rate
,
all_user
,
all_thread
);
}).
then
(
function
(
cont
,
y_user
,
user_rate
,
y_thread
,
thread_rate
,
all_user
,
all_thread
){
//返回数据
res
.
json
({
result
:
true
,
data
:{
user
:
y_user
,
user_rate
:
Math
.
round
(
user_rate
>
1
?
100
:
user_rate
<
0
?
0
:
user_rate
*
100
),
thread
:
y_thread
,
thread_rate
:
Math
.
round
(
thread_rate
>
1
?
100
:
thread_rate
<
0
?
0
:
thread_rate
*
100
)
thread_rate
:
Math
.
round
(
thread_rate
>
1
?
100
:
thread_rate
<
0
?
0
:
thread_rate
*
100
),
all_user
:
all_user
,
all_thread
:
all_thread
}})
}).
fail
(
function
(
cont
,
err
){
console
.
error
(
err
);
...
...
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