mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-01 15:32:48 +08:00
feat: 优化验证器逻辑
This commit is contained in:
@@ -6,7 +6,6 @@ use app\admin\model\SystemAdmin;
|
||||
use app\BaseController;
|
||||
use app\common\constants\AdminConstant;
|
||||
use app\common\service\AuthService;
|
||||
use think\facade\Cache;
|
||||
use think\facade\Config;
|
||||
use think\facade\Env;
|
||||
use think\facade\View;
|
||||
@@ -303,19 +302,21 @@ class AdminControllerBase extends BaseController
|
||||
$batch = $this->batchValidate;
|
||||
}
|
||||
|
||||
if ($this->validateRule instanceof Validate) {
|
||||
$this->validateRule->message($message);
|
||||
|
||||
// 是否批量验证
|
||||
if ($batch) {
|
||||
$this->validateRule->batch(true);
|
||||
}
|
||||
|
||||
$this->validateRule->failException(true)->check($data);
|
||||
} elseif (is_array($this->validateRule)) {
|
||||
parent::validate($data, $this->validateRule, $message, $batch);
|
||||
} else {
|
||||
if (!empty($validate)) {
|
||||
parent::validate($data, $validate, $message, $batch);
|
||||
} elseif (!empty($this->validateRule)) {
|
||||
if ($this->validateRule instanceof Validate) {
|
||||
$this->validateRule->message($message);
|
||||
|
||||
// 是否批量验证
|
||||
if ($batch) {
|
||||
$this->validateRule->batch(true);
|
||||
}
|
||||
|
||||
$this->validateRule->failException(true)->check($data);
|
||||
} elseif (is_array($this->validateRule)) {
|
||||
parent::validate($data, $this->validateRule, $message, $batch);
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$this->error($e->getMessage());
|
||||
@@ -521,7 +522,8 @@ class AdminControllerBase extends BaseController
|
||||
$this->assign('session_admin', $model_admin, -1);
|
||||
}
|
||||
|
||||
protected function readHeaderToken(){
|
||||
protected function readHeaderToken()
|
||||
{
|
||||
return read_header_token();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user