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
3c1fc31f
Commit
3c1fc31f
authored
Jul 07, 2015
by
陈志良
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
9737f463
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
7 deletions
+14
-7
forumLog.js
app/controllers/admin/forumLog.js
+11
-6
httpService.js
app/service/httpService.js
+3
-1
No files found.
app/controllers/admin/forumLog.js
View file @
3c1fc31f
...
...
@@ -333,10 +333,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
)
{
...
...
@@ -350,6 +351,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'
)
...
...
@@ -377,7 +379,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'
)
...
...
@@ -400,7 +403,8 @@ router.post('/getThreadActionStatistic', function(req, res, next) {
_
.
forEach
(
all_data_array
,
function
(
d
)
{
comment_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'
)
...
...
@@ -423,6 +427,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'
),
...
...
app/service/httpService.js
View file @
3c1fc31f
...
...
@@ -54,6 +54,7 @@ var sendThreadLogRequest = function(open_id, user_agent, origin_ip, method, nick
"source_channel"
:
source_channel
,
//分享入口渠道(0:官方直接分享;1:微信朋友圈;2:微信好友;3:QQ好友;4:腾讯微博;5:广告组;6:自媒体;)
"source_open_id"
:
source_open_id
//分享人的open_id
};
// console.log(obj);
redis
.
publish
(
'__pi_front_access_log_old__'
,
JSON
.
stringify
(
obj
),
function
(
err
,
reply
)
{
if
(
err
)
{
console
.
error
(
err
);
...
...
@@ -64,7 +65,8 @@ var sendThreadLogRequest = function(open_id, user_agent, origin_ip, method, nick
var
getClientIP
=
function
(
req
)
{
var
ipAddress
;
var
headers
=
req
.
headers
;
var
forwardedIpsStr
=
headers
[
'x-real-ip'
]
||
headers
[
'x-forwarded-for'
];
// console.log(headers);
var
forwardedIpsStr
=
headers
[
'remoteip'
]
||
headers
[
'x-real-ip'
]
||
headers
[
'x-forwarded-for'
];
if
(
forwardedIpsStr
)
{
ipAddress
=
forwardedIpsStr
;
}
else
{
...
...
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