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
b752dd3c
Commit
b752dd3c
authored
Mar 31, 2016
by
strong
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'bugfix_0328_plate_report'
parents
6dd31708
a8118d00
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
27 deletions
+31
-27
forumInfo.js
app/controllers/admin/forumInfo.js
+7
-21
forumLog.js
app/controllers/admin/forumLog.js
+24
-6
No files found.
app/controllers/admin/forumInfo.js
View file @
b752dd3c
...
...
@@ -338,15 +338,9 @@ router.post('/info/report/:id', function(req, res, next) {
},
info
:
info_id
};
var
group
=
{
_id
:
{
_id
:
'$_id'
},
count
:
{
$sum
:
1
}
};
mapReduce
(
ForumThread
,
match
,
group
,
d
,
cont
);
ForumThread
.
count
(
match
,
function
(
err
,
count
){
cont
(
err
,{
date
:
d
,
count
:
count
||
0
});
});
});
});
...
...
@@ -448,17 +442,12 @@ router.get('/info/report/exportXlsReport/:id', function(req, res, next) {
created
:
{
$gte
:
new
Date
(
d
+
' 00:00:00'
),
$lte
:
new
Date
(
d
+
' 23:59:59'
)
}
};
var
group
=
{
_id
:
{
_id
:
'$_id'
},
count
:
{
$sum
:
1
}
info
:
info_id
};
mapReduce
(
ForumThread
,
match
,
group
,
d
,
cont
);
ForumThread
.
count
(
match
,
function
(
err
,
count
){
cont
(
err
,{
date
:
d
,
count
:
count
||
0
});
});
});
});
...
...
@@ -523,9 +512,6 @@ router.get('/info/report/exportXlsReport/:id', function(req, res, next) {
});
}
});
}
else
{
res
.
json
({
result
:
false
,
...
...
app/controllers/admin/forumLog.js
View file @
b752dd3c
...
...
@@ -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