mirror of
https://gitee.com/apiadmin/ApiAdmin.git
synced 2025-04-06 03:58:00 +08:00
modified 完善规则验证
This commit is contained in:
parent
b54c0b002a
commit
6d99c4959c
@ -35,7 +35,7 @@ class RequestFilter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($newRule) {
|
if ($newRule) {
|
||||||
$validate = Validate::make($newRule);
|
$validate = Validate::rule($newRule);
|
||||||
if (!$validate->check($data)) {
|
if (!$validate->check($data)) {
|
||||||
return json(['code' => ReturnCode::PARAM_INVALID, 'msg' => $validate->getError(), 'data' => []]);
|
return json(['code' => ReturnCode::PARAM_INVALID, 'msg' => $validate->getError(), 'data' => []]);
|
||||||
}
|
}
|
||||||
@ -50,7 +50,7 @@ class RequestFilter {
|
|||||||
* @return array
|
* @return array
|
||||||
* @author zhaoxiang <zhaoxiang051405@gmail.com>
|
* @author zhaoxiang <zhaoxiang051405@gmail.com>
|
||||||
*/
|
*/
|
||||||
public function buildValidateRule($rule = array()) {
|
public function buildValidateRule($rule = []) {
|
||||||
$newRule = [];
|
$newRule = [];
|
||||||
if ($rule) {
|
if ($rule) {
|
||||||
foreach ($rule as $value) {
|
foreach ($rule as $value) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user