validator = Validator::make($data, $this->rules, $this->message); $this->requestData = $this->validator->getData(); if ($this->validator->fails()) { throw new ValidateException($this->validator->errors()->first()); } $this->validator->after(function () { $bool = $this->customValidate(); if (!$bool) { throw new ValidateException($this->validator->errors()->first(),Response::PARAM_ERROR); } }); } /** * 自定义验证(如有需要,子类进行重写) */ protected function customValidate(): bool { return true; } }