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
0d2cbf75
Commit
0d2cbf75
authored
Jul 23, 2015
by
陈家荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
222
parent
c34985e1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
62 deletions
+30
-62
forumLimitActionRef.js
app/controllers/admin/forumLimitActionRef.js
+30
-62
No files found.
app/controllers/admin/forumLimitActionRef.js
View file @
0d2cbf75
...
...
@@ -16,7 +16,7 @@ module.exports = function(app) {
//新增或更新论坛行为限制
router
.
post
(
'/limitActionRef/createOrUpdate'
,
function
(
req
,
res
,
next
)
{
var
ent_code
=
req
.
session
.
user
.
ent_code
;
var
mid
=
req
.
body
.
mi
d
;
var
userId
=
req
.
body
.
userI
d
;
var
selects
=
req
.
body
.
selects
;
var
limit_actions
=
[];
...
...
@@ -50,12 +50,12 @@ router.post('/limitActionRef/createOrUpdate', function(req, res, next) {
}
var
forumLimitActionRef
=
{
ent_code
:
ent_code
,
mid
:
mi
d
,
userId
:
userI
d
,
limit_actions
:
limit_actions
}
forumLimitActionRefService
.
createOrUpdateLimitActionRef
({
mid
:
mi
d
,
userId
:
userI
d
,
ent_code
:
ent_code
,
status
:
1
},
forumLimitActionRef
,
function
(
err
,
forum
)
{
...
...
@@ -72,11 +72,11 @@ router.post('/limitActionRef/createOrUpdate', function(req, res, next) {
})
});
//根据
mi
d获取论坛行为限制
router
.
get
(
'/limitActionRef/:
mi
d/get'
,
function
(
req
,
res
,
next
)
{
var
mid
=
req
.
params
.
mi
d
;
if
(
mi
d
)
{
forumLimitActionRefService
.
getLimitActionRefByMid
(
mi
d
,
function
(
err
,
forumLimitActionRef
)
{
//根据
userI
d获取论坛行为限制
router
.
get
(
'/limitActionRef/:
userI
d/get'
,
function
(
req
,
res
,
next
)
{
var
userId
=
req
.
params
.
userI
d
;
if
(
userI
d
)
{
forumLimitActionRefService
.
getLimitActionRefByMid
(
userI
d
,
function
(
err
,
forumLimitActionRef
)
{
if
(
err
)
{
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
...
...
@@ -91,61 +91,29 @@ router.get('/limitActionRef/:mid/get', function(req, res, next) {
}
});
//删除论坛行为限制
router
.
post
(
'/limitActionRef/:rid/delete'
,
function
(
req
,
res
,
next
)
{
var
rid
=
req
.
params
.
rid
;
if
(
rid
)
{
forumLimitActionRefService
.
deleteLimitActionRefById
(
rid
,
function
(
err
,
result
)
{
if
(
err
)
{
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
res
.
json
(
returnCode
.
SUCCESS
);
}
});
}
else
{
res
.
json
(
returnCode
.
WRONG_PARAM
);
}
});
//更新论坛行为限制
router
.
post
(
'/limitActionRef/:rid/update'
,
function
(
req
,
res
,
next
)
{
var
rid
=
req
.
params
.
rid
;
if
(
rid
)
{
forumLimitActionRefService
.
updateLimitActionRefById
(
rid
,
req
.
body
,
function
(
err
,
result
)
{
if
(
err
)
{
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
res
.
json
(
returnCode
.
SUCCESS
);
}
});
}
else
{
res
.
json
(
returnCode
.
WRONG_PARAM
);
}
});
//获取行为限制列表
router
.
get
(
'/limitActionRef/list'
,
function
(
req
,
res
,
next
)
{
var
pageNo
=
req
.
query
.
pageNo
||
1
;
var
pageSize
=
req
.
query
.
pageSize
||
10
;
var
limitActionName
=
req
.
query
.
limitActionName
;
//
router.get('/limitActionRef/list', function(req, res, next) {
//
var pageNo = req.query.pageNo || 1;
//
var pageSize = req.query.pageSize || 10;
//
var limitActionName = req.query.limitActionName;
var
conditions
=
{
ent_code
:
req
.
session
.
user
.
ent_code
};
if
(
limitActionName
)
{
conditions
.
title
=
{
$regex
:
limitActionName
,
$options
:
'i'
};
}
forumLimitActionRefService
.
getAllLimitActionRef
(
conditions
,
pageNo
,
pageSize
,
function
(
err
,
results
)
{
if
(
err
)
{
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
res
.
json
(
_
.
assign
(
results
,
returnCode
.
SUCCESS
));
}
});
});
//
var conditions = {
//
ent_code: req.session.user.ent_code
//
};
//
if (limitActionName) {
//
conditions.title = {
//
$regex: limitActionName,
//
$options: 'i'
//
};
//
}
//
forumLimitActionRefService.getAllLimitActionRef(conditions, pageNo, pageSize, function(err, results) {
//
if (err) {
//
console.error(err);
//
res.json(returnCode.BUSY);
//
} else {
//
res.json(_.assign(results, returnCode.SUCCESS));
//
}
//
});
//
});
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