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
e764cd24
Commit
e764cd24
authored
Jan 22, 2015
by
张淼
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
fe5664f8
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
212 additions
and
95 deletions
+212
-95
forumFavorite.js
app/controllers/forumFavorite.js
+22
-3
forumGroup.js
app/controllers/forumGroup.js
+22
-0
forumInfo.js
app/controllers/forumInfo.js
+46
-8
forumTag.js
app/controllers/forumTag.js
+35
-0
forumThread.js
app/controllers/forumThread.js
+87
-56
intergal.js
app/controllers/service/intergal.js
+0
-6
rolePermission.js
app/controllers/service/rolePermission.js
+0
-22
No files found.
app/controllers/forumFavorite.js
View file @
e764cd24
...
...
@@ -8,7 +8,7 @@ module.exports = function(app) {
};
//文章收藏
router
.
post
(
'/favorite/crea
et/:tid
'
,
function
(
req
,
res
,
next
)
{
router
.
post
(
'/favorite/crea
te
'
,
function
(
req
,
res
,
next
)
{
var
tid
=
req
.
body
.
tid
||
null
;
console
.
log
(
tid
);
//1.检查是否有权限
...
...
@@ -26,7 +26,21 @@ router.post('/favorite/creaet/:tid', function(req, res, next) {
});
//删除收藏
router
.
post
(
'/favorite/delete/:tid'
,
function
(
req
,
res
,
next
)
{
router
.
post
(
'/favorite/:fid/delete'
,
function
(
req
,
res
,
next
)
{
var
tid
=
req
.
body
.
tid
||
null
;
console
.
log
(
tid
);
//1.删除用户收藏
/**
返回数据:
{
errorcode:0,
errormsg:''
}
**/
});
//更新收藏
router
.
post
(
'/favorite/:fid/update'
,
function
(
req
,
res
,
next
)
{
var
tid
=
req
.
body
.
tid
||
null
;
console
.
log
(
tid
);
//1.删除用户收藏
...
...
@@ -40,6 +54,11 @@ router.post('/favorite/delete/:tid', function(req, res, next) {
});
//获取当前用户的收藏列表
router
.
get
(
'/favorite/getAll'
,
function
(
req
,
res
,
next
)
{
router
.
get
(
'/favorite/list'
,
function
(
req
,
res
,
next
)
{
console
.
log
(
''
);
});
//多条件搜索收藏列表
router
.
post
(
'/favorite/search'
,
function
(
req
,
res
,
next
)
{
console
.
log
(
''
);
});
app/controllers/forumGroup.js
View file @
e764cd24
...
...
@@ -40,4 +40,26 @@ router.get('/group/info/:gid', function(req, res, next) {
}
else
{
res
.
json
(
returnCode
.
WRONG_PARAM
);
}
});
/**
* [description]
* @param {[type]}
* @param {[type]}
* @param {Object}
* @return {[type]}
*/
router
.
get
(
'/group/:gid/forumInfos'
,
function
(
req
,
res
,
next
)
{
var
rs
=
{};
var
group
=
new
mongodb
.
ForumGroup
(
req
.
body
);
group
.
save
(
function
(
err
,
group
)
{
if
(
err
)
{
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
rs
.
data
=
group
;
res
.
json
(
_
.
assign
(
rs
,
returnCode
.
SUCCESS
));
}
});
});
\ No newline at end of file
app/controllers/forumInfo.js
View file @
e764cd24
...
...
@@ -4,7 +4,7 @@ var express = require('express'),
returnCode
=
require
(
'../utils/returnCode'
),
_
=
require
(
'lodash'
);
module
.
exports
=
function
(
app
)
{
app
.
use
(
'/forum'
,
router
);
app
.
use
(
'/
v1/
forum'
,
router
);
};
//新增论坛板块
...
...
@@ -20,6 +20,10 @@ router.post('/info/create', function(req, res, next) {
res
.
json
(
_
.
assign
(
rs
,
returnCode
.
SUCCESS
));
}
});
service
.
create
(
req
.
query
,
req
);
then
(
function
(
defer
){
});
});
...
...
@@ -42,12 +46,46 @@ router.get('/info/get/:fid', function(req, res, next) {
}
});
//根据论坛组ID获取目标论坛板块列表
router
.
get
(
'/info/get/:gid'
,
function
(
req
,
res
,
next
)
{
var
gid
=
req
.
params
.
gid
||
null
;
console
.
log
(
gid
);
//更新目标论坛板块
router
.
get
(
'/info/update/:fid'
,
function
(
req
,
res
,
next
)
{
console
.
log
(
''
);
});
//删除目标论坛板块
router
.
get
(
'/info/delete/:fid'
,
function
(
req
,
res
,
next
)
{
console
.
log
(
''
);
});
/**
* [description]
* @param {[type]}
* @param {[type]}
* @param {[type]}
* @return {[type]}
*/
router
.
get
(
'/info/:fid/threads'
,
function
(
req
,
res
,
next
)
{
console
.
log
(
''
);
});
//1.获取用户对应的角色
//2.获取当前角色可访问的板块列表
});
\ No newline at end of file
/**
获取目标论坛文章列表及标签列表
输入:文章板块ID
**/
router
.
get
(
'/thread/getAllThreadAndTag/:infoId'
,
function
(
req
,
res
,
next
)
{
console
.
log
(
''
);
//1.获取论坛文章
//2.获取标签列表
/**返回数据格式:
{
errorcode:0,
errormsg:'xxxxx',
"threads":[{文章对象},{文章对象}],
"tags":[{标签对象},{标签对象}]
}
**/
});
app/controllers/forumTag.js
0 → 100644
View file @
e764cd24
'use strict'
;
var
express
=
require
(
'express'
),
router
=
express
.
Router
(),
returnCode
=
require
(
'../utils/returnCode'
),
_
=
require
(
'lodash'
);
module
.
exports
=
function
(
app
)
{
app
.
use
(
'/v1/forum'
,
router
);
};
//新增论坛标签
router
.
post
(
'/tag/create'
,
function
(
req
,
res
,
next
)
{
console
.
log
(
''
);
});
router
.
post
(
'/tag/delete/:tid'
,
function
(
req
,
res
,
next
)
{
console
.
log
(
''
);
});
router
.
post
(
'/tag/update/:tid'
,
function
(
req
,
res
,
next
)
{
console
.
log
(
''
);
});
router
.
get
(
'/tag/get/:tid'
,
function
(
req
,
res
,
next
)
{
console
.
log
(
''
);
});
//查询所有标签
router
.
get
(
'/tag/list'
,
function
(
req
,
res
,
next
)
{
console
.
log
(
''
);
});
//查询标签下的文章列表
router
.
get
(
'/tag/:tid/threads'
,
function
(
req
,
res
,
next
)
{
console
.
log
(
''
);
});
\ No newline at end of file
app/controllers/forumThread.js
View file @
e764cd24
...
...
@@ -4,58 +4,10 @@ var express = require('express'),
returnCode
=
require
(
'../utils/returnCode'
),
_
=
require
(
'lodash'
);
module
.
exports
=
function
(
app
)
{
app
.
use
(
'/forum'
,
router
);
app
.
use
(
'/
v1/
forum'
,
router
);
};
//---------------------列表操作---------------------------------
/**
获取目标论坛文章列表
输入:文章板块ID
**/
router
.
get
(
'/thread/getAllThread/:infoId'
,
function
(
req
,
res
,
next
)
{
console
.
log
(
''
);
//1.获取论坛文章
/**返回数据格式:
{
"threads":[{文章对象},{文章对象}]
}
**/
});
/**
获取目标论坛文章列表及标签列表
输入:文章板块ID
**/
router
.
get
(
'/thread/getAllThreadAndTag/:infoId'
,
function
(
req
,
res
,
next
)
{
console
.
log
(
''
);
//1.获取论坛文章
//2.获取标签列表
/**返回数据格式:
{
"threads":[{文章对象},{文章对象}],
"tags":[{标签对象},{标签对象}]
}
**/
});
/**
根据标签获取目标论坛文章列表
输入:文章板块ID
**/
router
.
get
(
'/thread/getAllThreadByTagId/:tagId'
,
function
(
req
,
res
,
next
)
{
console
.
log
(
''
);
//1.获取论坛文章
/**返回数据格式:
{
"threads":[{文章对象},{文章对象}]
}
**/
});
//---------------------文章表单操作---------------------------------
//新增论坛文章
...
...
@@ -75,15 +27,34 @@ router.post('/thread/create', function(req, res, next) {
});
//获取目标论坛文章
router
.
get
(
'/thread/
get/:tid
'
,
function
(
req
,
res
,
next
)
{
router
.
get
(
'/thread/
:tid/get
'
,
function
(
req
,
res
,
next
)
{
console
.
log
(
''
);
//1.获取论坛文章
});
//更新文章状态、如:屏蔽
router
.
post
(
'/thread/:tid/update'
,
function
(
req
,
res
,
next
)
{
console
.
log
(
''
);
});
//2.获取评论、回复
//删除文章
router
.
post
(
'/thread/:tid/delete'
,
function
(
req
,
res
,
next
)
{
var
rs
=
{};
var
forum
=
new
mongodb
.
ForumThread
(
req
.
body
);
forum
.
save
(
function
(
err
,
forum
)
{
if
(
err
)
{
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
rs
.
data
=
forum
;
res
.
json
(
_
.
assign
(
rs
,
returnCode
.
SUCCESS
));
}
});
});
//更新文章点赞
数
router
.
post
(
'/thread/
updateRaise/:tid
'
,
function
(
req
,
res
,
next
)
{
//更新文章点赞
router
.
post
(
'/thread/
:tid/raise
'
,
function
(
req
,
res
,
next
)
{
var
tid
=
req
.
body
.
tid
||
null
;
console
.
log
(
tid
);
//1.检查是否有权限
...
...
@@ -103,8 +74,8 @@ router.post('/thread/updateRaise/:tid', function(req, res, next) {
**/
});
//更新文章分享
数
router
.
post
(
'/thread/
updateShare/:tid
'
,
function
(
req
,
res
,
next
)
{
//更新文章分享
router
.
post
(
'/thread/
:tid/share
'
,
function
(
req
,
res
,
next
)
{
var
tid
=
req
.
body
.
tid
||
null
;
console
.
log
(
tid
);
//1.检查是否有权限
...
...
@@ -132,7 +103,67 @@ router.post('/thread/updateShare/:tid', function(req, res, next) {
**输出:
操作结果
**/
router
.
post
(
'/thread/updateComment/:tid'
,
function
(
req
,
res
,
next
)
{
router
.
post
(
'/thread/:tid/comment/create'
,
function
(
req
,
res
,
next
)
{
var
tid
=
req
.
body
.
tid
||
null
;
console
.
log
(
tid
);
//1.检查是否有权限
//2.获取论坛文章
//3.新增文章评论
//4.更新文章统计数据(评论数)
/**
返回数据:
{
errorcode:0,
errormsg:''
}
**/
});
//新建文章评论的子评论
router
.
post
(
'/thread/:tid/comment/:cid/create'
,
function
(
req
,
res
,
next
)
{
var
tid
=
req
.
body
.
tid
||
null
;
console
.
log
(
tid
);
//1.检查是否有权限
//2.获取论坛文章
//3.新增文章评论
//4.更新文章统计数据(评论数)
/**
返回数据:
{
errorcode:0,
errormsg:''
}
**/
});
//删除文章评论
router
.
post
(
'/thread/:tid/comment/:cid/delete'
,
function
(
req
,
res
,
next
)
{
var
tid
=
req
.
body
.
tid
||
null
;
console
.
log
(
tid
);
//1.检查是否有权限
//2.获取论坛文章
//3.新增文章评论
//4.更新文章统计数据(评论数)
/**
返回数据:
{
errorcode:0,
errormsg:''
}
**/
});
//更新文章评论状态为:显示/不显示
router
.
post
(
'/thread/:tid/comment/:cid/:status'
,
function
(
req
,
res
,
next
)
{
var
tid
=
req
.
body
.
tid
||
null
;
console
.
log
(
tid
);
//1.检查是否有权限
...
...
app/controllers/service/intergal.js
deleted
100644 → 0
View file @
fe5664f8
'use strict'
;
//根据会员ID获取
exports
.
getIntegralById
=
function
(
mid
,
callback
){
console
.
log
(
''
);
};
\ No newline at end of file
app/controllers/service/rolePermission.js
deleted
100644 → 0
View file @
fe5664f8
'use strict'
;
//获取用户角色
exports
.
getRolePermiss
=
function
(
callback
){
//1.获取用户经验、积分
//2.获取角色权限列表
//3.根据积分、经验匹配对应的角色
};
//检查是否有操作权限
exports
.
checkRolePermiss
=
function
(
action
,
callback
){
var
action
=
req
.
query
.
action
||
''
;
//操作
//1.获取用户角色权限
//2.检查用户对应的角色是否有对应的操作权限
console
.
log
(
action
);
};
\ 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