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
9d522727
Commit
9d522727
authored
Apr 23, 2015
by
陈志良
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分享
parent
fa094401
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
29 deletions
+12
-29
forumShare.js
app/controllers/mobile/forumShare.js
+4
-28
httpService.js
app/service/httpService.js
+8
-1
No files found.
app/controllers/mobile/forumShare.js
View file @
9d522727
...
@@ -190,32 +190,13 @@ router.get('/:ent_code/share.js', function(req, res, next) {
...
@@ -190,32 +190,13 @@ router.get('/:ent_code/share.js', function(req, res, next) {
}
}
req
.
session
.
mobileForumUser
.
share_log
=
share_log
;
req
.
session
.
mobileForumUser
.
share_log
=
share_log
;
});
});
var
getClientIP
=
function
(
req
)
{
var
ipAddress
;
var
headers
=
req
.
headers
;
var
forwardedIpsStr
=
headers
[
'x-real-ip'
]
||
headers
[
'x-forwarded-for'
];
if
(
forwardedIpsStr
)
{
ipAddress
=
forwardedIpsStr
;
}
else
{
ipAddress
=
null
;
}
if
(
!
ipAddress
)
{
ipAddress
=
req
.
connection
.
remoteAddress
;
}
return
ipAddress
;
};
//微信分享朋友圈接口
//微信分享朋友圈接口
router
.
get
(
'/:ent_code/share/timeline'
,
function
(
req
,
res
,
next
)
{
router
.
get
(
'/:ent_code/share/timeline'
,
function
(
req
,
res
,
next
)
{
var
mid
=
req
.
session
.
openUser
.
mid
,
var
mid
=
req
.
session
.
openUser
.
mid
,
action
=
'share_timeline'
,
action
=
'share_timeline'
,
ent_code
=
req
.
session
.
user
.
ent_code
,
ent_code
=
req
.
session
.
user
.
ent_code
;
user
=
req
.
session
.
mobileForumUser
.
userId
,
httpService
.
createShareLog
(
req
,
1
);
open_id
=
req
.
session
.
mobileForumUser
.
openId
,
share_type
=
1
,
ip
=
getClientIP
(
req
),
userAgent
=
req
.
headers
[
'user-agent'
];
httpService
.
createShareLog
(
req
);
httpService
.
sendRequest
(
ent_code
,
mid
,
action
);
httpService
.
sendRequest
(
ent_code
,
mid
,
action
);
res
.
status
(
200
).
end
();
res
.
status
(
200
).
end
();
});
});
...
@@ -224,13 +205,8 @@ router.get('/:ent_code/share/timeline', function(req, res, next) {
...
@@ -224,13 +205,8 @@ router.get('/:ent_code/share/timeline', function(req, res, next) {
router
.
get
(
'/:ent_code/share/singlemessage'
,
function
(
req
,
res
,
next
)
{
router
.
get
(
'/:ent_code/share/singlemessage'
,
function
(
req
,
res
,
next
)
{
var
mid
=
req
.
session
.
openUser
.
mid
,
var
mid
=
req
.
session
.
openUser
.
mid
,
action
=
'share_singlemessage'
,
action
=
'share_singlemessage'
,
ent_code
=
req
.
session
.
user
.
ent_code
,
ent_code
=
req
.
session
.
user
.
ent_code
;
user
=
req
.
session
.
mobileForumUser
.
userId
,
httpService
.
createShareLog
(
req
,
2
);
open_id
=
req
.
session
.
mobileForumUser
.
openId
,
share_type
=
1
,
ip
=
getClientIP
(
req
),
userAgent
=
req
.
headers
[
'user-agent'
];
httpService
.
createShareLog
(
req
);
httpService
.
sendRequest
(
ent_code
,
mid
,
action
);
httpService
.
sendRequest
(
ent_code
,
mid
,
action
);
res
.
status
(
200
).
end
();
res
.
status
(
200
).
end
();
});
});
app/service/httpService.js
View file @
9d522727
...
@@ -98,9 +98,16 @@ exports.createLog = function(req,source,info,type,thread_type,thread,p_thread) {
...
@@ -98,9 +98,16 @@ exports.createLog = function(req,source,info,type,thread_type,thread,p_thread) {
}
}
};
};
exports
.
createShareLog
=
function
(
req
)
{
exports
.
createShareLog
=
function
(
req
,
share_type
)
{
var
logObj
=
req
.
session
.
mobileForumUser
.
share_log
;
var
logObj
=
req
.
session
.
mobileForumUser
.
share_log
;
logObj
.
source
=
req
.
session
.
mobileForumUser
.
source
;
logObj
.
source
=
req
.
session
.
mobileForumUser
.
source
;
logObj
.
mid
=
req
.
session
.
openUser
.
mid
;
logObj
.
ent_code
=
req
.
session
.
user
.
ent_code
;
logObj
.
user
=
req
.
session
.
mobileForumUser
.
userId
;
logObj
.
open_id
=
req
.
session
.
mobileForumUser
.
openId
;
logObj
.
ip
=
getClientIP
(
req
);
logObj
.
share_type
=
share_type
;
logObj
.
userAgent
=
req
.
headers
[
'user-agent'
];
if
(
logObj
){
if
(
logObj
){
then
(
function
(
cont
){
then
(
function
(
cont
){
var
share_log_model
=
new
ForumShareLog
(
logObj
);
var
share_log_model
=
new
ForumShareLog
(
logObj
);
...
...
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