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
9f314d69
Commit
9f314d69
authored
Apr 15, 2015
by
邓军
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
微信接口调整参数
parent
c6affd53
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
42 deletions
+27
-42
forumShare.js
app/controllers/mobile/forumShare.js
+23
-38
forumShareConfigService.js
app/service/forumShareConfigService.js
+4
-4
No files found.
app/controllers/mobile/forumShare.js
View file @
9f314d69
...
...
@@ -16,7 +16,7 @@ module.exports = function(app) {
app
.
use
(
'/v1/forum'
,
router
);
};
function
getWX
(
res
,
title
,
desc
,
link
,
imgUrl
,
mid
)
{
function
getWX
(
res
,
title
,
desc
,
link
,
imgUrl
,
mid
)
{
link
=
config
.
service
+
link
+
"&mid="
+
mid
;
res
.
writeHead
(
200
,
{
'Content-Type'
:
'text/javascript'
,
...
...
@@ -27,26 +27,11 @@ function getWX(res, title, desc, link, imgUrl,mid) {
// result.jsApiList = jsApiList;
res
.
write
(
'$(function(){'
);
// var title = type+'类型分享',
// link = 'http://sandbox.wxpai.cn/app/aubywx/100041',
// imgUrl = 'http://dev.fs.wxpai.cn/upload/100001_2015410_1428671539587_40.jpg',
// desc = '测试描述';
// var string = '';
var
string
=
'wx.onMenuShareTimeline({'
+
'
\
"title
\
":
\
"'
+
title
+
'
\
",'
+
'
\
"link
\
":
\
"'
+
link
+
'
\
",'
+
'
\
"imgUrl
\
":
\
"'
+
imgUrl
+
'
\
", '
+
'success: function(){},'
+
'cancel: function () {}'
+
' });'
+
' wx.onMenuShareAppMessage({'
+
'
\
"title
\
":
\
"'
+
title
+
'
\
", '
+
'
\
"desc
\
":
\
"'
+
desc
+
'
\
", '
+
'
\
"link
\
":
\
"'
+
link
+
'
\
", '
+
'
\
"imgUrl
\
":
\
"'
+
imgUrl
+
'
\
", '
+
'
\
"type
\
":
\'\'
,'
+
'
\
"dataUrl
\
":
\'\'
, '
+
'success: function(){},'
+
'cancel: function () { '
+
'}'
+
' });'
// link = 'http://sandbox.wxpai.cn/app/aubywx/100041',
// imgUrl = 'http://dev.fs.wxpai.cn/upload/100001_2015410_1428671539587_40.jpg',
// desc = '测试描述';
// var string = '';
var
string
=
'wx.onMenuShareTimeline({'
+
'
\
"title
\
":
\
"'
+
title
+
'
\
",'
+
'
\
"link
\
":
\
"'
+
link
+
'
\
",'
+
'
\
"imgUrl
\
":
\
"'
+
imgUrl
+
'
\
", '
+
'success: function(){},'
+
'cancel: function () {}'
+
' });'
+
' wx.onMenuShareAppMessage({'
+
'
\
"title
\
":
\
"'
+
title
+
'
\
", '
+
'
\
"desc
\
":
\
"'
+
desc
+
'
\
", '
+
'
\
"link
\
":
\
"'
+
link
+
'
\
", '
+
'
\
"imgUrl
\
":
\
"'
+
imgUrl
+
'
\
", '
+
'
\
"type
\
":
\'\'
,'
+
'
\
"dataUrl
\
":
\'\'
, '
+
'success: function(){},'
+
'cancel: function () { '
+
'}'
+
' });'
res
.
write
(
'wx.ready(function(){'
+
string
+
'});'
);
res
.
write
(
'wx.error(function(res){console.log(res);});'
);
...
...
@@ -61,7 +46,7 @@ router.get('/:ent_code/share.js', function(req, res, next) {
var
id
=
req
.
query
.
id
;
var
mid
=
req
.
session
.
openUser
.
mid
||
0
;
var
ent_code
=
req
.
params
.
ent_code
;
var
link
=
'/app/forum/'
+
ent_code
+
'/index/
'
;
var
link
=
'/app/forum/'
+
ent_code
+
'/index?pageUrl=
'
;
if
(
type
)
{
//板块微信接口
if
(
type
===
'Info'
)
{
...
...
@@ -81,8 +66,8 @@ router.get('/:ent_code/share.js', function(req, res, next) {
imgUrl
=
result
[
i
].
meta_value
;
}
}
link
=
link
+
'index.html?
infoId='
+
id
;
getWX
(
res
,
title
,
desc
,
link
,
imgUrl
,
mid
);
link
=
link
+
'index&
infoId='
+
id
;
getWX
(
res
,
title
,
desc
,
link
,
imgUrl
,
mid
);
}
else
{
cont
(
err
);
}
...
...
@@ -123,16 +108,16 @@ router.get('/:ent_code/share.js', function(req, res, next) {
if
(
sc
)
{
var
key
=
''
;
//1、文章 2、话题 3、照片墙
if
(
result
.
type
===
1
||
(
result
.
type
===
2
&&
result
.
level
===
2
))
{
link
=
link
+
'main.html?
infoId='
+
result
.
info
+
'&ent_code='
+
ent_code
+
'&id='
+
result
.
_id
;
link
=
link
+
'thread&
infoId='
+
result
.
info
+
'&ent_code='
+
ent_code
+
'&id='
+
result
.
_id
;
key
=
'article'
;
}
else
if
(
result
.
type
===
2
&&
result
.
level
===
1
)
{
link
=
link
+
'hot_topic.html?
infoId='
+
result
.
info
+
'&ent_code='
+
ent_code
+
'&id='
+
result
.
_id
;
link
=
link
+
'topicList&
infoId='
+
result
.
info
+
'&ent_code='
+
ent_code
+
'&id='
+
result
.
_id
;
key
=
'topic'
;
}
else
if
(
result
.
type
===
3
)
{
link
=
link
+
'photo.html?
infoId='
+
result
.
info
+
'&ent_code='
+
ent_code
+
'&id='
+
result
.
_id
;
link
=
link
+
'photoList&
infoId='
+
result
.
info
+
'&ent_code='
+
ent_code
+
'&id='
+
result
.
_id
;
key
=
'photo'
;
}
...
...
@@ -145,7 +130,7 @@ router.get('/:ent_code/share.js', function(req, res, next) {
imgUrl
=
sc
[
i
].
meta_value
;
}
}
getWX
(
res
,
title
,
desc
,
link
,
imgUrl
,
mid
);
getWX
(
res
,
title
,
desc
,
link
,
imgUrl
,
mid
);
}
else
{
cont
(
err
);
}
...
...
@@ -154,20 +139,20 @@ router.get('/:ent_code/share.js', function(req, res, next) {
//如果有分享设置,则返回分享设置
forumShareService
.
getById
(
result
.
share
,
function
(
err
,
forumShare
)
{
//1、文章 2、话题 3、照片墙
if
(
result
.
type
===
1
||
(
result
.
type
===
2
&&
result
.
level
===
2
))
{
link
=
link
+
'main.html?
infoId='
+
result
.
info
+
'&ent_code='
+
ent_code
+
'&id='
+
result
.
_id
;
//
key = 'article';
link
=
link
+
'thread&
infoId='
+
result
.
info
+
'&ent_code='
+
ent_code
+
'&id='
+
result
.
_id
;
//
key = 'article';
}
else
if
(
result
.
type
===
2
&&
result
.
level
===
1
)
{
link
=
link
+
'hot_topic.html?
infoId='
+
result
.
info
+
'&ent_code='
+
ent_code
+
'&id='
+
result
.
_id
;
//key = 'topic';
link
=
link
+
'topicList&
infoId='
+
result
.
info
+
'&ent_code='
+
ent_code
+
'&id='
+
result
.
_id
;
//key = 'topic';
}
else
if
(
result
.
type
===
3
)
{
link
=
link
+
'photo.html?
infoId='
+
result
.
info
+
'&ent_code='
+
ent_code
+
'&id='
+
result
.
_id
;
link
=
link
+
'photoList&
infoId='
+
result
.
info
+
'&ent_code='
+
ent_code
+
'&id='
+
result
.
_id
;
//key = 'photo';
}
getWX
(
res
,
forumShare
.
title
,
forumShare
.
description
,
link
,
forumShare
.
icon
,
mid
);
getWX
(
res
,
forumShare
.
title
,
forumShare
.
description
,
link
,
forumShare
.
icon
,
mid
);
});
}
}).
fail
(
function
(
cont
,
err
)
{
...
...
app/service/forumShareConfigService.js
View file @
9f314d69
...
...
@@ -4,10 +4,10 @@ var ForumShareConfig = mongoose.model('ForumShareConfig');
var
async
=
require
(
'async'
);
//创建配置信息
exports
.
create
ForumShareConfig
=
function
(
entity
,
callback
){
var
forumShareConfig
=
new
ForumShareConfig
(
entity
);
forumShareConfig
.
save
(
function
(
err
,
forumShareConfig
)
{
//
批量
创建配置信息
exports
.
create
=
function
(
entity
,
callback
){
//
var forumShareConfig = new ForumShareConfig(entity);
ForumShareConfig
.
create
(
entity
,
function
(
err
,
forumShareConfig
)
{
if
(
err
)
{
console
.
error
(
err
);
callback
(
err
,
null
);
...
...
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