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

分享 - 功能添加

parent a1b4cb97
This diff is collapsed.
......@@ -5,36 +5,72 @@ var mongoose = require('mongoose'),
//分享日志
var ForumShareLogSchema = new Schema({
ent_code: {
type: Number,
require: true,
index: true
},
user: { //分享者
type: Schema.Types.ObjectId,
require: true,
index: true,
ref: 'ForumUser'
},
thread: { //分享内容
type: Schema.Types.ObjectId,
require: true,
index: true,
ref: 'ForumThread'
},
destination: { //分享的目标,微信好友,微信朋友圈,QQ空间,微博等等
type: String,
require: true,
index: true
},
ip: { //IP地址
type: String,
require: true
},
created: { //分享时间
type: Date,
require: true,
default: Date.now
}
type: Number,
require: true,
index: true
},
user: { //访问者
type: String,
require: true,
index: true,
ref: 'ForumUser'
},
mid: { //会员ID
type: Number,
require: true,
index: true
},
open_id: { //微信公众号唯一识别
type: String,
require: true,
index: true
},
info: { //板块ID
type: String,
index: true,
ref: 'ForumInfo'
},
thread: { //话题、文章、照片墙的ID
type: String,
index: true,
ref: 'forumThread'
},
type: { //页面:1.主页 2.板块 3.文章
type: Number,
index: true,
require: true
},
thread_type: { //文章类型:1.话题 2.文章 3.照片墙 4.子文章
type: Number,
index: true
},
share_type:{ //分享类型:1.微信朋友圈 2.微信单人 3.微信组
type: Number,
index: true,
require: true
},
p_thread: { //父文章ID
type: String,
index: true,
ref: 'forumThread'
},
source: { //分享者
type: String,
require: true,
index: true,
ref: 'ForumUser'
},
ip: { //IP地址
type: String
},
userAgent: {
type: String
},
created: {
type: Date,
required: true,
default: Date.now
}
}, {
'collection': 'pisns_forum_share_log'
});
......
......@@ -16,8 +16,9 @@ var mongoose = require('mongoose'),
moment = require('moment'),
then = require('thenjs');
var ForumPVLog = mongoose.model('ForumPVLog');
var ForumUVLog = mongoose.model('ForumUVLog');
var ForumPVLog = mongoose.model('ForumPVLog'),
ForumUVLog = mongoose.model('ForumUVLog'),
ForumShareLog = mongoose.model('ForumShareLog');
exports.sendRequest = function(ent_code, mid, action, messageid, integral, exp) {
var obj = {
tag: 'member',
......@@ -51,7 +52,6 @@ var getClientIP = function(req) {
};
exports.createLog = function(req,source,info,type,thread_type,thread,p_thread) {
var logObj = {
ent_code: req.session.user.ent_code,
source:source,
......@@ -97,3 +97,17 @@ exports.createLog = function(req,source,info,type,thread_type,thread,p_thread) {
console.error('没有日志信息');
}
};
exports.createShareLog = function(req) {
var logObj = req.session.mobileForumUser.share_log;
logObj.source = req.session.mobileForumUser.source;
if(logObj){
then(function(cont){
var share_log_model = new ForumShareLog(logObj);
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