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
daea34fe
Commit
daea34fe
authored
Jul 07, 2015
by
陈家荣
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'development' of git.wxpai.cn:scrmgroup/pisns-forum-api into development
Conflicts: app/controllers/admin/forumLog.js
parents
fb26d915
3c1fc31f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
16 deletions
+17
-16
forumLog.js
app/controllers/admin/forumLog.js
+17
-16
No files found.
app/controllers/admin/forumLog.js
View file @
daea34fe
...
...
@@ -19,8 +19,6 @@ var ForumPvLog = mongoose.model('ForumPVLog'),
ForumUser
=
mongoose
.
model
(
'ForumUser'
),
ForumThread
=
mongoose
.
model
(
'ForumThread'
);
var
Mongoose
=
require
(
'mongoose'
);
var
ObjectId
=
Mongoose
.
Types
.
ObjectId
;
module
.
exports
=
function
(
app
)
{
app
.
use
(
'/admin/forum'
,
router
);
...
...
@@ -112,7 +110,7 @@ function countSex(t_id, sex, callback) {
//社区情况(首页)
router
.
get
(
'/statistic'
,
function
(
req
,
res
,
next
)
{
router
.
get
(
'/statistic'
,
function
(
req
,
res
,
next
)
{
var
yesterday
=
moment
(
new
Date
().
getTime
()
-
24
*
3600
*
1000
).
format
(
'YYYY-MM-DD'
),
before_yesterday
=
moment
(
new
Date
().
getTime
()
-
2
*
24
*
3600
*
1000
).
format
(
'YYYY-MM-DD'
);
var
ent_code
=
req
.
session
.
user
.
ent_code
,
...
...
@@ -207,9 +205,8 @@ router.get('/statistic', function(req, res, next) {
var
y_user
=
datas
[
0
],
by_user
=
datas
[
1
],
y_thread
=
datas
[
2
],
by_thread
=
datas
[
3
];
all_user
=
datas
[
4
];
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
,
...
...
@@ -340,10 +337,11 @@ router.post('/getThreadViewStatistic', function(req, res, next) {
//文章行为统计
router
.
post
(
'/getThreadActionStatistic'
,
function
(
req
,
res
,
next
)
{
// 1.获取文章的创建日期,和今天的日期,转换成日期数组
var
t_id
=
req
.
body
.
t_id
;
var
begin_time
=
req
.
body
.
beginDate
;
var
ent_time
=
req
.
body
.
endDate
;
var
all_data_array
=
get_all_date
(
begin_time
,
ent_time
);
var
t_id
=
req
.
body
.
t_id
,
ent_code
=
req
.
session
.
user
.
ent_code
,
begin_time
=
req
.
body
.
beginDate
,
ent_time
=
req
.
body
.
endDate
,
all_data_array
=
get_all_date
(
begin_time
,
ent_time
);
// 2.根据数组统计PV,UV,行为
if
(
begin_time
&&
ent_time
)
{
...
...
@@ -357,6 +355,7 @@ router.post('/getThreadActionStatistic', function(req, res, next) {
_
.
forEach
(
all_data_array
,
function
(
d
)
{
userThreadControl_tasks
.
push
(
function
(
cont
)
{
var
match
=
{
ent_code
:
ent_code
,
created
:
{
$gte
:
new
Date
(
d
+
' 00:00:00'
),
$lte
:
new
Date
(
d
+
' 23:59:59'
)
...
...
@@ -384,7 +383,8 @@ router.post('/getThreadActionStatistic', function(req, res, next) {
_
.
forEach
(
all_data_array
,
function
(
d
)
{
praise_tasks
.
push
(
function
(
cont
)
{
var
match
=
{
thread
:
t_id
,
ent_code
:
ent_code
,
thread
:
new
mongoose
.
Types
.
ObjectId
(
t_id
),
created
:
{
$gte
:
new
Date
(
d
+
' 00:00:00'
),
$lte
:
new
Date
(
d
+
' 23:59:59'
)
...
...
@@ -407,8 +407,8 @@ router.post('/getThreadActionStatistic', function(req, res, next) {
_
.
forEach
(
all_data_array
,
function
(
d
)
{
comment_tasks
.
push
(
function
(
cont
)
{
var
match
=
{
// thread: t_id
,
thread
:
new
ObjectId
(
t_id
),
ent_code
:
ent_code
,
thread
:
new
mongoose
.
Types
.
ObjectId
(
t_id
),
created
:
{
$gte
:
new
Date
(
d
+
' 00:00:00'
),
$lte
:
new
Date
(
d
+
' 23:59:59'
)
...
...
@@ -431,6 +431,7 @@ router.post('/getThreadActionStatistic', function(req, res, next) {
_
.
forEach
(
all_data_array
,
function
(
d
)
{
share_tasks
.
push
(
function
(
cont
)
{
var
match
=
{
ent_code
:
ent_code
,
thread
:
t_id
,
created
:
{
$gte
:
new
Date
(
d
+
' 00:00:00'
),
...
...
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