修改request
This commit is contained in:
parent
6c12887f8d
commit
79863215b3
@ -2,6 +2,7 @@
|
|||||||
namespace catcher\base;
|
namespace catcher\base;
|
||||||
|
|
||||||
use app\Request;
|
use app\Request;
|
||||||
|
use catcher\exceptions\FailedException;
|
||||||
use catcher\exceptions\ValidateFailedException;
|
use catcher\exceptions\ValidateFailedException;
|
||||||
use think\Validate;
|
use think\Validate;
|
||||||
|
|
||||||
@ -27,10 +28,14 @@ class CatchRequest extends Request
|
|||||||
*/
|
*/
|
||||||
protected function validate()
|
protected function validate()
|
||||||
{
|
{
|
||||||
$validate = new Validate();
|
try {
|
||||||
|
$validate = new Validate();
|
||||||
|
|
||||||
if (!$validate->check(request()->param(), $this->rules())) {
|
if (!$validate->check(request()->param(), $this->rules())) {
|
||||||
throw new ValidateFailedException($validate->getError());
|
throw new FailedException($validate->getError());
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw new ValidateFailedException($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user