Commit bf9fac7d authored by 陈家荣's avatar 陈家荣

增加论坛文章的redis

parent cc92c4da
......@@ -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);
});
});
}
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment