修改auth认证

This commit is contained in:
wuyanwen
2020-01-07 17:27:55 +08:00
parent f7ac1a23bf
commit c9b39327a5
8 changed files with 280 additions and 66 deletions

View File

@@ -1,46 +1,9 @@
<?php
namespace catcher\base;
use catcher\validates\Sometimes;
use think\Validate;
abstract class CatchValidate extends Validate
class CatchValidate extends Validate
{
public function __construct()
{
parent::__construct();
$this->register();
$this->rule = $this->getRules();
}
abstract protected function getRules(): array ;
/**
*
* @time 2019年12月07日
* @return void
*/
private function register(): void
{
if (!empty($this->newValidates())) {
foreach ($this->newValidates() as $validate) {
$this->extend($validate->type(), [$validate, 'verify'], $validate->message());
}
}
}
/**
*
* @time 2019年12月07日
* @return array
*/
private function newValidates(): array
{
return [
new Sometimes(),
];
}
}