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
ae864859
Commit
ae864859
authored
Apr 23, 2015
by
陈志良
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分享 - 功能添加
parent
a1b4cb97
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
251 additions
and
206 deletions
+251
-206
forumShare.js
app/controllers/mobile/forumShare.js
+168
-173
forumShareLog.js
app/models/forumShareLog.js
+66
-30
httpService.js
app/service/httpService.js
+17
-3
No files found.
app/controllers/mobile/forumShare.js
View file @
ae864859
This diff is collapsed.
Click to expand it.
app/models/forumShareLog.js
View file @
ae864859
...
...
@@ -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'
});
...
...
app/service/httpService.js
View file @
ae864859
...
...
@@ -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
);
});
}
};
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