添加请求参数验证
parent
c185008896
commit
a3caf5c56f
|
@ -128,7 +128,7 @@ class ArticleController extends CController
|
|||
$params = $this->request->inputs(['class_id', 'class_name']);
|
||||
$this->validate($params, [
|
||||
'class_id' => 'required|integer',
|
||||
'class_name' => 'required'
|
||||
'class_name' => 'required|max:20'
|
||||
]);
|
||||
|
||||
$class_id = $this->articleService->editArticleClass($this->uid(), $params['class_id'], $params['class_name']);
|
||||
|
@ -218,7 +218,7 @@ class ArticleController extends CController
|
|||
$params = $this->request->inputs(['tag_id', 'tag_name']);
|
||||
$this->validate($params, [
|
||||
'tag_id' => 'required|integer|min:0',
|
||||
'tag_name' => 'required'
|
||||
'tag_name' => 'required|max:20'
|
||||
]);
|
||||
|
||||
$id = $this->articleService->editArticleTag($this->uid(), (int)$params['tag_id'], $params['tag_name']);
|
||||
|
|
|
@ -211,8 +211,8 @@ class GroupController extends CController
|
|||
$params = $this->request->inputs(['group_id', 'group_name', 'group_profile', 'avatar']);
|
||||
$this->validate($params, [
|
||||
'group_id' => 'required|integer',
|
||||
'group_name' => 'required',
|
||||
'group_profile' => 'required',
|
||||
'group_name' => 'required|max:30',
|
||||
'group_profile' => 'required|max:100',
|
||||
'avatar' => 'present|url'
|
||||
]);
|
||||
|
||||
|
@ -323,7 +323,7 @@ class GroupController extends CController
|
|||
$params = $this->request->inputs(['group_id', 'visit_card']);
|
||||
$this->validate($params, [
|
||||
'group_id' => 'required|integer',
|
||||
'visit_card' => 'required'
|
||||
'visit_card' => 'required|max:20'
|
||||
]);
|
||||
|
||||
$isTrue = UsersGroupMember::where('group_id', $params['group_id'])
|
||||
|
@ -432,7 +432,7 @@ class GroupController extends CController
|
|||
$this->validate($params, [
|
||||
'group_id' => 'required|integer',
|
||||
'notice_id' => 'required|integer',
|
||||
'title' => 'required',
|
||||
'title' => 'required|max:50',
|
||||
'content' => 'required'
|
||||
]);
|
||||
|
||||
|
|
|
@ -240,8 +240,8 @@ class UsersController extends CController
|
|||
{
|
||||
$params = $this->request->inputs(['friend_id', 'remarks']);
|
||||
$this->validate($params, [
|
||||
'friend_id' => 'required|integer',
|
||||
'remarks' => "required"
|
||||
'friend_id' => 'required|integer|min:1',
|
||||
'remarks' => "required|max:20"
|
||||
]);
|
||||
|
||||
$user_id = $this->uid();
|
||||
|
@ -265,7 +265,7 @@ class UsersController extends CController
|
|||
$params = $this->request->inputs(['friend_id', 'remarks']);
|
||||
$this->validate($params, [
|
||||
'friend_id' => 'required|integer',
|
||||
'remarks' => 'present'
|
||||
'remarks' => 'present|max:50'
|
||||
]);
|
||||
|
||||
$user = $this->userService->findById($params['friend_id']);
|
||||
|
@ -307,7 +307,7 @@ class UsersController extends CController
|
|||
$params = $this->request->inputs(['apply_id', 'remarks']);
|
||||
$this->validate($params, [
|
||||
'apply_id' => 'required|integer',
|
||||
'remarks' => 'present'
|
||||
'remarks' => 'present|max:20'
|
||||
]);
|
||||
|
||||
$user_id = $this->uid();
|
||||
|
|
Loading…
Reference in New Issue