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
bf9fac7d
Commit
bf9fac7d
authored
Jul 02, 2015
by
陈家荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加论坛文章的redis
parent
cc92c4da
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
2 deletions
+45
-2
httpService.js
app/service/httpService.js
+45
-2
No files found.
app/service/httpService.js
View file @
bf9fac7d
...
...
@@ -37,6 +37,32 @@ exports.sendRequest = function(ent_code, mid, action, messageid, integral, exp)
}
});
};
//推送文章记录
var
sendThreadLogRequest
=
function
(
open_id
,
user_agent
,
origin_ip
,
method
,
nick_name
,
ent_code
,
mid
,
business_type
,
business_id
,
request_time
,
source_channel
,
source_open_id
)
{
var
obj
=
{
"open_id"
:
open_id
,
"user_agent"
:
user_agent
,
"origin_ip"
:
origin_ip
,
//发起请求终端的ip地址
"method"
:
method
,
//请求method
"nick_name"
:
nick_name
,
//昵称,默认为会员名,如果没有则返回当前渠道的nick_name(如微信昵称)
"ent_code"
:
ent_code
,
//企业号
"mid"
:
mid
,
"business_type"
:
business_type
,
//业务分类,用于标识不同的业务类型(如news,forum等)
"business_id"
:
business_id
,
//业务记录的唯一标识,如news_id等
"request_time"
:
request_time
||
new
Date
(),
//发起请求的时间
"source_channel"
:
source_channel
,
//分享入口渠道(0:官方直接分享;1:微信朋友圈;2:微信好友;3:QQ好友;4:腾讯微博;5:广告组;6:自媒体;)
"source_open_id"
:
source_open_id
//分享人的open_id
};
console
.
log
(
'----------------'
);
console
.
log
(
obj
);
redis
.
lpush
(
'adapter-redis-to-ons'
,
JSON
.
stringify
(
obj
),
function
(
err
,
reply
)
{
if
(
err
)
{
console
.
error
(
err
);
}
});
};
var
getClientIP
=
function
(
req
)
{
var
ipAddress
;
var
headers
=
req
.
headers
;
...
...
@@ -67,6 +93,23 @@ exports.createLog = function(req,source,info,type,thread_type,thread,p_thread) {
ip
:
getClientIP
(
req
),
userAgent
:
req
.
headers
[
'user-agent'
]
};
//推送
sendThreadLogRequest
(
req
.
session
.
mobileForumUser
.
openId
,
req
.
headers
[
'user-agent'
],
getClientIP
(
req
),
null
,
req
.
session
.
user
.
nick_name
,
req
.
session
.
user
.
ent_code
,
req
.
session
.
openUser
.
mid
,
'forum.'
+
info
,
thread
,
null
,
null
,
null
);
if
(
logObj
)
{
then
(
function
(
cont
){
var
pv_model
=
new
ForumPVLog
(
logObj
);
...
...
@@ -115,7 +158,7 @@ exports.createShareLog = function(req,share_type) {
share_log_model
.
save
(
cont
);
}).
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