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
c6b7a6fa
Commit
c6b7a6fa
authored
Mar 30, 2016
by
strong
Browse files
Options
Browse Files
Download
Plain Diff
Merge commit '
a8118d00
' into remould_0330_dashboard_optimize
parents
e14ee388
a8118d00
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
6 deletions
+24
-6
forumLog.js
app/controllers/admin/forumLog.js
+24
-6
No files found.
app/controllers/admin/forumLog.js
View file @
c6b7a6fa
...
...
@@ -568,8 +568,9 @@ router.get('/statistic_v2', function(req, res, next) {
var
ent_code
=
req
.
query
.
ent_code
,
y_begin
=
new
Date
(
req
.
query
.
day
+
' 00:00:00'
),
//开始时间
y_end
=
new
Date
(
req
.
query
.
day
+
' 23:59:59'
);
//结束时间
then
.
parallel
([
then
.
series
([
function
(
cont
)
{
var
s1
=
new
Date
().
getTime
();
//昨天访问用户
var
match
=
{
ent_code
:
Number
(
ent_code
),
...
...
@@ -578,15 +579,27 @@ router.get('/statistic_v2', function(req, res, next) {
$lte
:
y_end
}
};
aggregate
(
ForumUvLog
,
match
,
{
open_id
:
'$open_id'
},
{
'created'
:
-
1
},
function
(
err
,
docs
)
{
var
o
=
{};
var
emit
;
o
.
map
=
function
()
{
emit
(
this
.
open_id
,
1
);
};
o
.
reduce
=
function
(
k
,
vals
)
{
var
sum
=
0
;
vals
.
forEach
(
function
(
val
){
sum
+=
val
;
});
return
sum
;
};
o
.
query
=
match
;
ForumUvLog
.
mapReduce
(
o
,
function
(
err
,
docs
)
{
console
.
log
(
'耗时1'
,(
new
Date
().
getTime
()
-
s1
)
/
1000
);
cont
(
err
,
docs
.
length
);
});
},
function
(
cont
)
{
var
s1
=
new
Date
().
getTime
();
//昨天发帖数
var
match
=
{
ent_code
:
Number
(
ent_code
),
...
...
@@ -596,10 +609,12 @@ router.get('/statistic_v2', function(req, res, next) {
}
};
ForumThread
.
count
(
match
,
function
(
err
,
count
)
{
console
.
log
(
'耗时2'
,(
new
Date
().
getTime
()
-
s1
)
/
1000
);
cont
(
err
,
count
);
});
},
function
(
cont
)
{
var
s1
=
new
Date
().
getTime
();
//总访问量
var
match
=
{
ent_code
:
Number
(
ent_code
),
...
...
@@ -608,10 +623,12 @@ router.get('/statistic_v2', function(req, res, next) {
}
};
ForumPvLog
.
count
(
match
,
function
(
err
,
count
)
{
console
.
log
(
'耗时3'
,(
new
Date
().
getTime
()
-
s1
)
/
1000
);
cont
(
err
,
count
);
});
},
function
(
cont
)
{
var
s1
=
new
Date
().
getTime
();
//总发帖数
var
match
=
{
ent_code
:
Number
(
ent_code
),
...
...
@@ -620,6 +637,7 @@ router.get('/statistic_v2', function(req, res, next) {
}
};
ForumThread
.
count
(
match
,
function
(
err
,
count
)
{
console
.
log
(
'耗时4'
,(
new
Date
().
getTime
()
-
s1
)
/
1000
);
cont
(
err
,
count
);
});
}
...
...
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