用户管理

This commit is contained in:
wuyanwen
2019-12-11 20:59:59 +08:00
parent ae7fd47a5d
commit 22064c6178
26 changed files with 1306 additions and 274 deletions

View File

@@ -0,0 +1,42 @@
<?php
namespace catcher\base;
use app\Request;
use catcher\exceptions\ValidateFailedException;
use think\Validate;
abstract class BaseRequest extends Request
{
/**
* Request constructor.
* @throws \Exception
*/
public function __construct()
{
parent::__construct();
$this->validate();
}
/**
* 初始化验证
*
* @time 2019年11月27日
* @throws \Exception
* @return mixed
*/
protected function validate()
{
$validate = new Validate();
if (!$validate->check(request()->param(), $this->rules())) {
throw new ValidateFailedException($validate->getError());
}
return true;
}
abstract protected function rules(): array;
abstract protected function message(): array;
}