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
7596abfc
Commit
7596abfc
authored
Jan 26, 2016
by
刘文胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1111
parent
0bb11017
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
29 deletions
+63
-29
forumShare.js
app/controllers/mobile/forumShare.js
+63
-29
No files found.
app/controllers/mobile/forumShare.js
View file @
7596abfc
...
...
@@ -16,6 +16,8 @@ var forumThreadService = require('../../service/forumThreadService'),
// forumLimitActionRefService = require('../../service/forumLimitActionRefService'),
forumLimitOperationService
=
require
(
'../../service/forumLimitOperationService'
);
var
redis
=
global
.
redis
;
module
.
exports
=
function
(
app
)
{
app
.
use
(
'/v1/forum'
,
router
);
};
...
...
@@ -304,39 +306,71 @@ 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
;
}
var
key
=
ent_code
+
'forum_share_index_info'
;
var
expire
=
60
*
60
;
redis
.
get
(
key
,
function
(
error
,
share
){
if
(
share
){
//有缓存
try
{
share
=
JSON
.
parse
(
share
);
title
=
share
.
title
;
desc
=
share
.
desc
;
link
=
share
.
linkUrl
;
imgUrl
=
share
.
imgUrl
;
if
(
link
.
indexOf
(
'?'
)
===
-
1
){
link
=
link
+
'?uId='
+
uId
;
}
else
{
link
=
link
+
'&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
);
}
}
catch
(
err
){
console
.
log
(
err
);
}
getWXV2
(
res
,
title
,
desc
,
link
,
imgUrl
,
mid
,
ent_code
,
id
,
type
,
null
,
true
);
}
else
{
then
.
parallel
([
function
(
cont
){
//type为index时的,默认link
link
=
config
.
service
+
'/app/forum/'
+
ent_code
+
'/mediashequn'
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
){
link
=
result
.
data
;
}
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
();
});
}
cont
();
]).
then
(
function
(
cont
,
datas
)
{
//放入redis缓存
redis
.
set
(
key
,
JSON
.
stringify
({
title
:
title
,
desc
:
desc
,
linkUrl
:
link
,
imgUrl
:
imgUrl
}),
function
(){
redis
.
expire
(
key
,
expire
);
});
if
(
link
.
indexOf
(
'?'
)
===
-
1
){
link
=
link
+
'?uId='
+
uId
;
}
else
{
link
=
link
+
'&uId='
+
uId
;
}
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
));
});
}
]).
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
{
//板块微信接口
...
...
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