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
13e85e0e
Commit
13e85e0e
authored
Aug 31, 2015
by
陈志良
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
图片墙发帖 - 合并帖子
parent
d13937bc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
72 additions
and
16 deletions
+72
-16
forumInfo.js
app/controllers/mobile/forumInfo.js
+1
-1
forumThread.js
app/controllers/mobile/forumThread.js
+55
-10
forumThreadService.js
app/service/forumThreadService.js
+13
-2
config.js
config/config.js
+3
-3
No files found.
app/controllers/mobile/forumInfo.js
View file @
13e85e0e
...
...
@@ -567,7 +567,7 @@ router.get('/info/myAttend', function(req, res, next) {
});
cont
(
null
,
threadIds
);
}
else
{
res
.
json
(
_
.
assign
({
data
:[],
total
:
0
},
returnCode
.
SUCCESS
));
res
.
json
(
_
.
assign
({
items
:[],
total
:
0
},
returnCode
.
SUCCESS
));
}
}
});
...
...
app/controllers/mobile/forumThread.js
View file @
13e85e0e
...
...
@@ -32,6 +32,8 @@ function create(req, callback) {
entity
.
pid
=
null
;
}
var
address
=
entity
.
address
||
null
;
if
(
address
)
{
entity
.
address
=
JSON
.
parse
(
address
);
...
...
@@ -54,15 +56,39 @@ function create(req, callback) {
entity
.
images
=
array
;
}
//-----------处理前端上传图片结束
forumThreadService
.
createThread
(
entity
,
function
(
err
,
entity
)
{
if
(
err
)
{
console
.
error
(
err
);
callback
(
err
,
null
);
}
else
{
callback
(
null
,
entity
);
}
});
if
(
entity
.
pid
&&
entity
.
type
==
3
){
forumThreadService
.
getByConditions
({
type
:
3
,
level
:
'2'
,
pid
:
entity
.
pid
,
from
:
entity
.
from
},
function
(
err
,
doc
){
if
(
doc
){
var
update
=
{
$set
:{
images
:
entity
.
images
,
content
:
entity
.
content
}
};
forumThreadService
.
updateThreadById
(
doc
.
_id
,
update
,
function
(
err
,
updatedDoc
){
callback
(
err
,
entity
);
});
}
else
{
forumThreadService
.
createThread
(
entity
,
function
(
err
,
entity
)
{
if
(
err
)
{
console
.
error
(
err
);
callback
(
err
,
null
);
}
else
{
callback
(
null
,
entity
);
}
});
}
});
}
else
{
forumThreadService
.
createThread
(
entity
,
function
(
err
,
entity
)
{
if
(
err
)
{
console
.
error
(
err
);
callback
(
err
,
null
);
}
else
{
callback
(
null
,
entity
);
}
});
}
}
//根据发帖者分页查询话题列表
...
...
@@ -235,6 +261,26 @@ router.get('/thread/:tid/get', function(req, res, next) {
}
});
//获取目标论坛文章
router
.
get
(
'/thread/photo/:pid/get'
,
function
(
req
,
res
,
next
)
{
var
pid
=
req
.
params
.
pid
||
null
,
userId
=
req
.
session
.
mobileForumUser
.
userId
;;
if
(
pid
)
{
forumThreadService
.
getByConditions
({
type
:
3
,
level
:
'2'
,
pid
:
pid
,
from
:
userId
},
function
(
err
,
thread
){
if
(
err
)
{
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
var
rs
=
{};
rs
.
data
=
thread
;
res
.
json
(
_
.
assign
(
rs
,
returnCode
.
SUCCESS
));
}
});
}
else
{
res
.
json
(
returnCode
.
WRONG_PARAM
);
}
});
//更新文章状态、如:屏蔽
router
.
post
(
'/thread/:tid/update'
,
function
(
req
,
res
,
next
)
{
var
tid
=
req
.
params
.
tid
;
...
...
@@ -1339,4 +1385,3 @@ router.post('/thread/:tid/disable', function(req, res, next) {
res
.
json
(
returnCode
.
WRONG_PARAM
);
}
});
app/service/forumThreadService.js
View file @
13e85e0e
...
...
@@ -122,7 +122,17 @@ exports.getById = function(id, callback) {
}
});
}
//根据ID获取文章记录,不查评论,子话题
exports
.
getByConditions
=
function
(
conditions
,
callback
)
{
ForumThread
.
findOne
(
conditions
,
function
(
err
,
result
)
{
if
(
err
)
{
console
.
error
(
err
);
callback
(
err
,
null
);
}
else
{
callback
(
null
,
result
);
}
});
}
//根据ID获取文章
exports
.
getThreadById
=
function
(
tid
,
callback
)
{
async
.
parallel
([
...
...
@@ -1033,4 +1043,5 @@ exports.getAllThreadByFidAndNickName = function(nickName, conditions, pageNo, pa
}
});
}
\ No newline at end of file
}
//获取某个文章
config/config.js
View file @
13e85e0e
...
...
@@ -67,7 +67,7 @@ var config = {
app
:
{
name
:
'pisns-forum-api'
},
service
:
'http://pi
sn
s.wxpai.cn'
,
service
:
'http://pi
plu
s.wxpai.cn'
,
port
:
3011
,
mongodb
:
{
...
...
@@ -86,9 +86,9 @@ var config = {
devCDNURL
:
'http://dev.fs.wxpai.cn/'
},
sessionStore
:
{
password
:
'
future123456
'
,
password
:
'
a39131f8d598429f:GuangZhouhdp123
'
,
port
:
6379
,
host
:
'
10.168.27.179
'
,
host
:
'
a39131f8d598429f.m.cnhza.kvstore.aliyuncs.com
'
,
db
:
2
}
}
...
...
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