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
590f5d04
Commit
590f5d04
authored
Mar 26, 2015
by
张淼
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
5c1f5d74
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
71 additions
and
34 deletions
+71
-34
forumThread.js
app/controllers/admin/forumThread.js
+3
-3
forumTag.js
app/controllers/mobile/forumTag.js
+18
-0
forumThread.js
app/controllers/mobile/forumThread.js
+43
-30
forumTag.js
app/models/forumTag.js
+6
-0
forumThread.js
app/models/forumThread.js
+1
-1
No files found.
app/controllers/admin/forumThread.js
View file @
590f5d04
...
...
@@ -30,7 +30,7 @@ router.post('/thread/create', function(req, res, next) {
var
rs
=
{};
req
.
body
.
ent_code
=
req
.
session
.
user
.
ent_code
;
var
uid
=
'abcdefdfddfssfds'
;
var
uid
=
req
.
session
.
user
.
id
;
if
(
userUtil
.
getUserSession
(
req
)){
req
.
body
.
from
=
userUtil
.
getUserSession
.
_id
;
...
...
@@ -68,8 +68,8 @@ router.post('/thread/create', function(req, res, next) {
}
else
{
var
entity
=
{
uid
:
uid
,
nickName
:
'管理员'
,
icon
:
'http://fs.wxpai.cn/aofei/youyouqiu.png'
nickName
:
req
.
session
.
user
.
name
,
icon
:
req
.
session
.
user
.
headPic
};
forumUserService
.
createUser
(
entity
,
function
(
err
,
doc
){
if
(
err
){
...
...
app/controllers/mobile/forumTag.js
View file @
590f5d04
...
...
@@ -35,6 +35,24 @@ router.get('/tag/list', function(req, res, next) {
});
});
//查询前台可使用的所有标签(针对发帖)
router
.
get
(
'/tag/mobileList'
,
function
(
req
,
res
,
next
)
{
var
pageNo
=
req
.
query
.
pageNo
||
1
;
var
pageSize
=
req
.
query
.
pageSize
||
10
;
var
conditions
=
{
ent_code
:
req
.
session
.
user
.
ent_code
,
type
:
1
};
forumTagService
.
getAllTag
(
conditions
,
pageNo
,
pageSize
,
function
(
err
,
results
){
if
(
err
){
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
res
.
json
(
_
.
assign
(
results
,
returnCode
.
SUCCESS
));
}
});
});
//查询标签下的文章列表
router
.
get
(
'/tag/:tid/threads'
,
function
(
req
,
res
,
next
)
{
var
pageNo
=
req
.
query
.
pageNo
||
1
;
...
...
app/controllers/mobile/forumThread.js
View file @
590f5d04
...
...
@@ -27,34 +27,47 @@ module.exports = function(app) {
//新增论坛文章
router
.
post
(
'/thread/create'
,
function
(
req
,
res
,
next
)
{
var
rs
=
{};
req
.
body
.
ent_code
=
req
.
session
.
user
.
ent_code
;
req
.
body
.
from
=
user
.
getMobileUser
(
req
);
// console.log(req.body);
var
integral
=
req
.
session
.
openUser
.
integral
||
0
;
var
exp
=
req
.
session
.
openUser
.
exp
||
0
;
//-----------处理前端上传图片开始
//格式为['http://imageurl','http://imageurl'],
//转换为[{urlFileName:'http://imageUrL'},{urlFileName:'http://imageUrL'}]
var
images
=
req
.
body
.
images
;
if
(
images
){
var
array
=
[];
for
(
var
i
=
0
;
i
<
images
.
length
;
i
=
i
+
1
){
array
.
push
({
urlFileName
:
images
[
i
]
});
}
req
.
body
.
images
=
array
;
}
//-----------处理前端上传图片结束
forumThreadService
.
createThread
(
req
.
body
,
function
(
err
,
entity
){
if
(
err
)
{
console
.
error
(
err
);
forumRolePermissionService
.
checkRolePermiss
(
req
.
session
.
user
.
ent_code
,
'create'
,
integral
,
exp
,
function
(
err
,
result
){
if
(
err
){
res
.
json
(
returnCode
.
BUSY
);
}
else
{
rs
.
data
=
{
'id'
:
entity
.
_id
};
res
.
json
(
_
.
assign
(
rs
,
returnCode
.
SUCCESS
));
}
}
else
{
if
(
result
){
//有操作权限
var
rs
=
{};
req
.
body
.
ent_code
=
req
.
session
.
user
.
ent_code
;
req
.
body
.
from
=
user
.
getMobileUser
(
req
);
// console.log(req.body);
//-----------处理前端上传图片开始
//格式为['http://imageurl','http://imageurl'],
//转换为[{urlFileName:'http://imageUrL'},{urlFileName:'http://imageUrL'}]
var
images
=
req
.
body
.
images
;
if
(
images
){
var
array
=
[];
for
(
var
i
=
0
;
i
<
images
.
length
;
i
=
i
+
1
){
array
.
push
({
urlFileName
:
images
[
i
]
});
}
req
.
body
.
images
=
array
;
}
//-----------处理前端上传图片结束
forumThreadService
.
createThread
(
req
.
body
,
function
(
err
,
entity
){
if
(
err
)
{
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
rs
.
data
=
{
'id'
:
entity
.
_id
};
res
.
json
(
_
.
assign
(
rs
,
returnCode
.
SUCCESS
));
}
});
}
else
{
res
.
json
(
returnCode
.
ACTION_NOT_PERMISSION
);
}
}
});
});
...
...
@@ -233,11 +246,11 @@ router.post('/thread/:tid/raise', function(req, res, next) {
});
}
});
}
else
{
res
.
json
(
returnCode
.
ACTION_NOT_PERMISSION
);
}
}
else
{
res
.
json
(
returnCode
.
ACTION_NOT_PERMISSION
);
}
});
}
});
}
}
});
...
...
app/models/forumTag.js
View file @
590f5d04
...
...
@@ -13,6 +13,12 @@ var ForumTagSchema = new Schema({
type
:
String
,
require
:
true
,
},
type
:
{
// 标签类型 1、前后台通用 2、后台使用
type
:
Number
,
require
:
true
,
index
:
true
,
default
:
1
},
icon
:
{
//标签图片
type
:
String
},
...
...
app/models/forumThread.js
View file @
590f5d04
...
...
@@ -25,7 +25,7 @@ var ForumThreadSchema = new Schema({
type
:
String
,
require
:
true
},
type
:{
//文章类型 1、文章 2、照片墙
type
:{
//文章类型 1、文章 2、照片墙
3、话题
type
:
Number
,
require
:
true
},
...
...
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