Commit b2911383 authored by 陈志良's avatar 陈志良

论坛 - 分享

parent bbbf4b7b
...@@ -49,7 +49,10 @@ var ForumPVLogSchema = new Schema({ ...@@ -49,7 +49,10 @@ var ForumPVLogSchema = new Schema({
index: true index: true
}, },
source: { //分享者 source: { //分享者
type: String type: String,
require: true,
index: true,
ref: 'ForumUser'
}, },
ip: { //IP地址 ip: { //IP地址
type: String type: String
......
...@@ -49,7 +49,10 @@ var ForumUVLogSchema = new Schema({ ...@@ -49,7 +49,10 @@ var ForumUVLogSchema = new Schema({
index: true index: true
}, },
source: { //分享者 source: { //分享者
type: String type: String,
require: true,
index: true,
ref: 'ForumUser'
}, },
ip: { //IP地址 ip: { //IP地址
type: String type: String
......
...@@ -50,10 +50,11 @@ var getClientIP = function(req) { ...@@ -50,10 +50,11 @@ var getClientIP = function(req) {
return ipAddress; return ipAddress;
}; };
exports.createLog = function(req,info,type,thread_type,thread,p_thread) { exports.createLog = function(req,source,info,type,thread_type,thread,p_thread) {
var logObj = { var logObj = {
ent_code: req.session.user.ent_code, ent_code: req.session.user.ent_code,
source:source,
mid: req.session.openUser.mid, mid: req.session.openUser.mid,
open_id: req.session.mobileForumUser.openId, open_id: req.session.mobileForumUser.openId,
user: req.session.mobileForumUser.userId, user: req.session.mobileForumUser.userId,
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
var forumUserService=require('../service/forumUserService'); var forumUserService=require('../service/forumUserService');
exports.getMobileUser=function(req){ exports.getMobileUser=function(req){
// return req.session.mobileForumUser.userId; return req.session.mobileForumUser.userId;
return '55015675868b65a028187c49'; // return '55015675868b65a028187c49';
} }
exports.getOpenId=function(req){ exports.getOpenId=function(req){
...@@ -24,6 +24,10 @@ exports.identifyUser=function() { ...@@ -24,6 +24,10 @@ exports.identifyUser=function() {
userId:doc._id, userId:doc._id,
openId:doc.uid openId:doc.uid
}; };
if(req.session.source){
req.session.mobileForumUser.source = req.session.source;
delete req.session.source;
}
next(null); next(null);
}else{ }else{
if(req.session.tmpOpenId){ if(req.session.tmpOpenId){
...@@ -44,6 +48,11 @@ exports.identifyUser=function() { ...@@ -44,6 +48,11 @@ exports.identifyUser=function() {
userId:doc._id, userId:doc._id,
openId:doc.uid openId:doc.uid
}; };
if(req.session.source){
req.session.mobileForumUser.source = req.session.source;
delete req.session.source;
}
next(null); next(null);
} }
}); });
......
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