modified 完善规则验证

This commit is contained in:
zhaoxiang 2020-10-13 17:00:03 +08:00
parent b54c0b002a
commit 6d99c4959c

View File

@ -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) {