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
c9f35151
Commit
c9f35151
authored
Mar 23, 2015
by
张淼
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
29e994f2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
1 deletion
+42
-1
testHttp.js
app/controllers/admin/testHttp.js
+20
-0
forumThread.js
app/controllers/mobile/forumThread.js
+7
-1
httpService.js
app/service/httpService.js
+11
-0
user.js
app/utils/user.js
+4
-0
No files found.
app/controllers/admin/testHttp.js
0 → 100644
View file @
c9f35151
'use strict'
;
var
express
=
require
(
'express'
),
router
=
express
.
Router
();
var
httpService
=
require
(
'../../service/httpService'
);
module
.
exports
=
function
(
app
)
{
app
.
use
(
'/admin/forum'
,
router
);
};
router
.
post
(
'/http/send'
,
function
(
req
,
res
,
next
)
{
httpService
.
sendRequest
(
''
,
''
,
''
);
res
.
json
(
'success'
);
});
router
.
get
(
'/http/receive'
,
function
(
req
,
res
,
next
)
{
// console.log(req.query.ent_code);
});
\ No newline at end of file
app/controllers/mobile/forumThread.js
View file @
c9f35151
...
...
@@ -14,6 +14,8 @@ var forumShareLogService=require('../../service/forumShareLogService');
var
forumCommentService
=
require
(
'../../service/forumCommentService'
);
var
forumUserThreadControlService
=
require
(
'../../service/forumUserThreadControlService'
);
var
httpService
=
require
(
'../../service/httpService'
);
var
user
=
require
(
'../../utils/user'
);
var
async
=
require
(
'async'
);
module
.
exports
=
function
(
app
)
{
...
...
@@ -216,6 +218,7 @@ router.post('/thread/:tid/raise', function(req, res, next) {
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
httpService
.
sendRequest
(
req
.
session
.
user
.
ent_code
,
user
.
getOpenId
(),
tid
,
'raise'
);
res
.
json
(
returnCode
.
SUCCESS
);
}
});
...
...
@@ -290,6 +293,7 @@ router.post('/thread/:tid/share', function(req, res, next) {
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
httpService
.
sendRequest
(
req
.
session
.
user
.
ent_code
,
user
.
getOpenId
(),
tid
,
'share'
);
res
.
json
(
returnCode
.
SUCCESS
);
}
});
...
...
@@ -388,6 +392,7 @@ router.post('/thread/:tid/comment/create', function(req, res, next) {
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
httpService
.
sendRequest
(
req
.
session
.
user
.
ent_code
,
user
.
getOpenId
(),
tid
,
'comment'
);
async
.
parallel
([
function
(
callback
){
//获取最新5条评论
...
...
@@ -418,7 +423,6 @@ router.post('/thread/:tid/comment/create', function(req, res, next) {
if
(
err
){
res
.
json
(
returnCode
.
BUSY
);
}
else
{
console
.
log
(
'in...................'
);
var
rs
=
{};
rs
.
comments
=
results
[
0
].
items
;
rs
.
commentCount
=
results
[
1
].
comment_count
;
...
...
@@ -513,6 +517,7 @@ router.post('/thread/:tid/comment/:cid/create', function(req, res, next) {
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
httpService
.
sendRequest
(
req
.
session
.
user
.
ent_code
,
user
.
getOpenId
(),
tid
,
'reply'
);
ForumComment
.
populate
(
results
[
0
],
{
path
:
'from to'
,
select
:
'uid nickName icon comments'
}
,
function
(
err
,
c
){
if
(
err
){
res
.
json
(
returnCode
.
BUSY
);
...
...
@@ -670,6 +675,7 @@ router.post('/thread/:tid/comment/:cid/raise', function(req, res, next) {
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
httpService
.
sendRequest
(
req
.
session
.
user
.
ent_code
,
user
.
getOpenId
(),
tid
,
'raise'
);
res
.
json
(
returnCode
.
SUCCESS
);
}
});
...
...
app/service/httpService.js
0 → 100644
View file @
c9f35151
'use strict'
;
var
request
=
require
(
'request'
);
var
REMOTE_URL
=
'http://127.0.0.1:3011/admin/forum/http/receive'
;
exports
.
sendRequest
=
function
(
ent_code
,
uid
,
tid
,
action
){
var
url
=
REMOTE_URL
+
'?ent_code='
+
ent_code
+
'&uid='
+
uid
+
'&tid='
+
tid
+
'&action='
+
action
;
request
.
get
({
url
:
url
},
function
(
e
,
r
,
body
)
{
});
}
\ No newline at end of file
app/utils/user.js
View file @
c9f35151
...
...
@@ -12,6 +12,10 @@ exports.getMobileUser=function(req){
return
"55015675868b65a028187c49"
;
}
exports
.
getOpenId
=
function
(
req
){
return
'openId'
;
}
exports
.
setMobileUser
=
function
(
req
){
}
\ No newline at end of file
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