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
d046aa8e
Commit
d046aa8e
authored
Jan 26, 2016
by
刘文胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
社区分享
parent
ab6de49e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
142 additions
and
97 deletions
+142
-97
forumShare.js
app/controllers/mobile/forumShare.js
+139
-97
config.js
config/config.js
+3
-0
No files found.
app/controllers/mobile/forumShare.js
View file @
d046aa8e
...
...
@@ -3,6 +3,7 @@ var express = require('express'),
router
=
express
.
Router
(),
_
=
require
(
'lodash'
),
then
=
require
(
'thenjs'
),
request
=
require
(
'request'
),
mongoose
=
require
(
'mongoose'
);
var
forumThreadService
=
require
(
'../../service/forumThreadService'
),
...
...
@@ -236,10 +237,14 @@ router.get('/:ent_code/share/singlemessage', function(req, res, next) {
}
});
});
function
getWXV2
(
res
,
title
,
desc
,
link
,
imgUrl
,
mid
,
ent_code
,
id
,
type
,
forumThread
)
{
function
getWXV2
(
res
,
title
,
desc
,
link
,
imgUrl
,
mid
,
ent_code
,
id
,
type
,
forumThread
,
fullurl
)
{
//['{板块名称}','{文章标题}','{话题名称}','{照片墙标题}'];
//share_type:是否使用默认设置:1使用默认分享设置 2.使用自己的分享设置
if
(
fullurl
){
link
=
link
+
"&mid="
+
mid
;
}
else
{
link
=
config
.
service
+
link
+
"&mid="
+
mid
;
}
if
(
type
===
"Info"
)
{
forumInfoService
.
getInfoById
(
id
,
function
(
err
,
forumInfo
)
{
...
...
@@ -298,6 +303,42 @@ router.get('/sharev2.js', function(req, res, next) {
var
title
=
''
,
desc
=
''
,
imgUrl
=
''
;
if
(
type
&&
type
===
'index'
){
then
.
parallel
([
function
(
cont
){
//type为index时的,默认link
link
=
config
.
service
+
'/app/forum/'
+
ent_code
+
'/mediashequn'
+
'?uId='
+
uId
;
request
.
get
({
url
:
config
.
rest_api
+
'/v1.0/internal/forum/config/enter/byentcode?entCode='
+
ent_code
,
body
:{},
json
:
true
},
function
(
e
,
r
,
result
)
{
if
(
result
.
data
){
if
(
result
.
data
.
indexOf
(
'?'
)
===
-
1
){
link
=
result
.
data
+
'?uId='
+
uId
;
}
else
{
link
=
result
.
data
+
'&uId='
+
uId
;
}
}
cont
();
});
},
function
(
cont
){
request
.
get
({
url
:
config
.
rest_api
+
'/v1.0/internal/forum/config/share/byentcode?entCode='
+
ent_code
,
body
:{},
json
:
true
},
function
(
e
,
r
,
result
)
{
if
(
result
.
data
){
try
{
var
obj
=
JSON
.
parse
(
result
.
data
);
title
=
obj
.
shareTitle
||
''
;
desc
=
obj
.
shareDescription
||
''
;
imgUrl
=
obj
.
sharePictureUrl
||
''
;
}
catch
(
err
){
console
.
log
(
err
);
}
}
cont
();
});
}
]).
then
(
function
(
cont
,
datas
)
{
getWXV2
(
res
,
title
,
desc
,
link
,
imgUrl
,
mid
,
ent_code
,
id
,
type
,
null
,
true
);
}).
fail
(
function
(
cont
,
err
)
{
res
.
json
(
_
.
assign
({
result
:
false
},
returnCode
.
WRONG_PARAM
));
});
}
else
{
//板块微信接口
if
(
!
type
||
!
id
){
console
.
error
(
'请求参数错误'
)
...
...
@@ -400,4 +441,5 @@ router.get('/sharev2.js', function(req, res, next) {
res
.
json
(
_
.
assign
({
result
:
false
},
returnCode
.
WRONG_PARAM
));
});
}
}
});
\ No newline at end of file
config/config.js
View file @
d046aa8e
...
...
@@ -9,6 +9,7 @@ var config = {
app
:
{
name
:
'pisns-forum-api'
},
rest_api
:
'http://localhost:8080'
,
service
:
'http://localhost'
,
port
:
3011
,
mongodb
:
{
...
...
@@ -38,6 +39,7 @@ var config = {
app
:
{
name
:
'pisns-forum-api'
},
rest_api
:
'http://rest.wxpai.cn'
,
service
:
'http://sandbox.wxpai.cn'
,
port
:
3011
,
mongodb
:
{
...
...
@@ -67,6 +69,7 @@ var config = {
app
:
{
name
:
'pisns-forum-api'
},
rest_api
:
'https://rest.wxpai.cn'
,
service
:
'http://piplus.wxpai.cn'
,
port
:
3011
,
...
...
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