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
73132f66
Commit
73132f66
authored
Aug 29, 2015
by
陈志良
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
5b022b8a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
5 deletions
+39
-5
forumShare.js
app/controllers/mobile/forumShare.js
+39
-5
No files found.
app/controllers/mobile/forumShare.js
View file @
73132f66
...
...
@@ -258,7 +258,38 @@ router.get('/:ent_code/share/singlemessage', function(req, res, next) {
}
});
});
function
getWXV2
(
res
,
title
,
desc
,
link
,
imgUrl
,
mid
,
ent_code
,
id
,
type
,
forumThread
)
{
//['{板块名称}','{文章标题}','{话题名称}','{照片墙标题}'];
//share_type:是否使用默认设置:1使用默认分享设置 2.使用自己的分享设置
link
=
config
.
service
+
link
+
"&mid="
+
mid
;
if
(
type
===
"Info"
)
{
forumInfoService
.
getInfoById
(
id
,
function
(
err
,
forumInfo
)
{
if
(
err
||
forumInfo
<
1
)
{
console
.
error
(
"板块不存在或者发生未知错误"
);
res
.
json
({
message
:
'板块不存在或者发生未知错误'
,
result
:
false
,
code
:
'10002'
,
error
:
err
});
}
else
{
title
=
title
.
replace
(
/{板块名称}/g
,
forumInfo
.
name
);
desc
=
desc
.
replace
(
/{板块名称}/g
,
forumInfo
.
name
);
}
});
}
else
if
(
type
===
"Thread"
){
title
=
title
.
replace
(
/{文章标题}|{话题名称}|{照片墙标题}/g
,
forumThread
.
title
);
desc
=
desc
.
replace
(
/{文章标题}|{话题名称}|{照片墙标题}/g
,
forumThread
.
title
);
}
res
.
json
({
title
:
title
,
desc
:
desc
,
link
:
link
,
imgUrl
:
imgUrl
,
ent_code
:
ent_code
});
}
//微信分享接口
router
.
get
(
'/sharev2.js'
,
function
(
req
,
res
,
next
)
{
var
rs
=
{},
...
...
@@ -273,6 +304,8 @@ router.get('/sharev2.js', function(req, res, next) {
mid
=
req
.
session
.
openUser
.
mid
;
}
delete
req
.
session
.
mobileForumUser
.
share_log
;
console
.
log
(
type
);
console
.
log
(
id
);
//板块微信接口
if
(
!
type
||
!
id
){
console
.
error
(
'请求参数错误'
)
...
...
@@ -294,7 +327,7 @@ router.get('/sharev2.js', function(req, res, next) {
desc
=
shareInfo
.
description
||
''
,
imgUrl
=
shareInfo
.
icon
||
''
;
link
=
link
+
'index&infoId='
+
id
+
'&uId='
+
uId
;
getWX
(
res
,
title
,
desc
,
link
,
imgUrl
,
mid
,
ent_code
,
id
,
type
,
null
);
getWX
V2
(
res
,
title
,
desc
,
link
,
imgUrl
,
mid
,
ent_code
,
id
,
type
,
null
);
return
;
}
else
{
//默认分享设置 //查询板块默认分享设置
...
...
@@ -316,7 +349,8 @@ router.get('/sharev2.js', function(req, res, next) {
}
});
link
=
link
+
'index&infoId='
+
id
+
'&uId='
+
uId
;
getWX
(
res
,
title
,
desc
,
link
,
imgUrl
,
mid
,
ent_code
,
id
,
type
,
null
);
console
.
log
(
1
);
getWXV2
(
res
,
title
,
desc
,
link
,
imgUrl
,
mid
,
ent_code
,
id
,
type
,
null
);
}
else
{
//没找到板块默认分享设置
console
.
error
(
'info默认分享设置不存在'
);
...
...
@@ -378,7 +412,7 @@ router.get('/sharev2.js', function(req, res, next) {
return
;
}
});
getWX
(
res
,
title
,
desc
,
link
,
imgUrl
,
mid
,
ent_code
,
thread
.
_id
,
type
,
thread
);
getWX
V2
(
res
,
title
,
desc
,
link
,
imgUrl
,
mid
,
ent_code
,
thread
.
_id
,
type
,
thread
);
}
});
}
else
{
...
...
@@ -389,7 +423,7 @@ router.get('/sharev2.js', function(req, res, next) {
console
.
error
(
err
||
'文章个性化分享设置不存在'
);
res
.
json
(
_
.
assign
({
result
:
false
},
returnCode
.
DATA_NOTEXITS
));
}
else
{
getWX
(
res
,
forumShare
.
title
,
forumShare
.
description
,
link
,
forumShare
.
icon
,
mid
,
ent_code
,
thread
.
_id
,
type
,
thread
);
getWX
V2
(
res
,
forumShare
.
title
,
forumShare
.
description
,
link
,
forumShare
.
icon
,
mid
,
ent_code
,
thread
.
_id
,
type
,
thread
);
}
});
}
...
...
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