add
This commit is contained in:
73
app/admin/validate/Admin.php
Normal file
73
app/admin/validate/Admin.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class Admin extends Validate
|
||||
{
|
||||
protected $failException = true;
|
||||
|
||||
protected $rule = [
|
||||
'username' => 'require|regex:^[a-zA-Z][a-zA-Z0-9_]{2,15}$|unique:admin',
|
||||
'nickname' => 'require',
|
||||
'password' => 'require|regex:^(?!.*[&<>"\'\n\r]).{6,32}$',
|
||||
'email' => 'email|unique:admin',
|
||||
'mobile' => 'mobile|unique:admin',
|
||||
'group_arr' => 'require|array',
|
||||
];
|
||||
|
||||
/**
|
||||
* 验证提示信息
|
||||
* @var array
|
||||
*/
|
||||
protected $message = [];
|
||||
|
||||
/**
|
||||
* 字段描述
|
||||
*/
|
||||
protected $field = [
|
||||
];
|
||||
|
||||
/**
|
||||
* 验证场景
|
||||
*/
|
||||
protected $scene = [
|
||||
'add' => ['username', 'nickname', 'password', 'email', 'mobile', 'group_arr'],
|
||||
];
|
||||
|
||||
/**
|
||||
* 验证场景-前台自己修改自己资料
|
||||
*/
|
||||
public function sceneInfo(): Admin
|
||||
{
|
||||
return $this->only(['nickname', 'password', 'email', 'mobile'])
|
||||
->remove('password', 'require');
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证场景-编辑资料
|
||||
*/
|
||||
public function sceneEdit(): Admin
|
||||
{
|
||||
return $this->only(['username', 'nickname', 'password', 'email', 'mobile', 'group_arr'])
|
||||
->remove('password', 'require');
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->field = [
|
||||
'username' => __('Username'),
|
||||
'nickname' => __('Nickname'),
|
||||
'password' => __('Password'),
|
||||
'email' => __('Email'),
|
||||
'mobile' => __('Mobile'),
|
||||
'group_arr' => __('Group Name Arr'),
|
||||
];
|
||||
$this->message = array_merge($this->message, [
|
||||
'username.regex' => __('Please input correct username'),
|
||||
'password.regex' => __('Please input correct password')
|
||||
]);
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
46
app/admin/validate/AdminGroup.php
Normal file
46
app/admin/validate/AdminGroup.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class AdminGroup extends Validate
|
||||
{
|
||||
protected $failException = true;
|
||||
|
||||
protected $rule = [
|
||||
'name' => 'require',
|
||||
'rules' => 'require',
|
||||
];
|
||||
|
||||
/**
|
||||
* 验证提示信息
|
||||
* @var array
|
||||
*/
|
||||
protected $message = [];
|
||||
|
||||
/**
|
||||
* 字段描述
|
||||
*/
|
||||
protected $field = [
|
||||
];
|
||||
|
||||
/**
|
||||
* 验证场景
|
||||
*/
|
||||
protected $scene = [
|
||||
'add' => ['name', 'rules'],
|
||||
'edit' => ['name', 'rules'],
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->field = [
|
||||
'name' => __('name'),
|
||||
];
|
||||
$this->message = [
|
||||
'rules' => __('Please select rules'),
|
||||
];
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
46
app/admin/validate/AdminRule.php
Normal file
46
app/admin/validate/AdminRule.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class AdminRule extends Validate
|
||||
{
|
||||
protected $failException = true;
|
||||
|
||||
protected $rule = [
|
||||
'type' => 'require',
|
||||
'title' => 'require',
|
||||
'name' => 'require|unique:admin_rule',
|
||||
];
|
||||
|
||||
/**
|
||||
* 验证提示信息
|
||||
* @var array
|
||||
*/
|
||||
protected $message = [];
|
||||
|
||||
/**
|
||||
* 字段描述
|
||||
*/
|
||||
protected $field = [
|
||||
];
|
||||
|
||||
/**
|
||||
* 验证场景
|
||||
*/
|
||||
protected $scene = [
|
||||
'add' => ['type', 'title', 'name'],
|
||||
'edit' => ['type', 'title', 'name'],
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->field = [
|
||||
'type' => __('type'),
|
||||
'title' => __('title'),
|
||||
'name' => __('name'),
|
||||
];
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
41
app/admin/validate/Config.php
Normal file
41
app/admin/validate/Config.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class Config extends Validate
|
||||
{
|
||||
protected $failException = true;
|
||||
|
||||
protected $rule = [
|
||||
'name' => 'require|unique:config',
|
||||
];
|
||||
|
||||
/**
|
||||
* 验证提示信息
|
||||
* @var array
|
||||
*/
|
||||
protected $message = [];
|
||||
|
||||
/**
|
||||
* 字段描述
|
||||
*/
|
||||
protected $field = [
|
||||
];
|
||||
|
||||
/**
|
||||
* 验证场景
|
||||
*/
|
||||
protected $scene = [
|
||||
'add' => ['name'],
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->field = [
|
||||
'name' => __('Variable name'),
|
||||
];
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
48
app/admin/validate/DataRecycle.php
Normal file
48
app/admin/validate/DataRecycle.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class DataRecycle extends Validate
|
||||
{
|
||||
protected $failException = true;
|
||||
|
||||
protected $rule = [
|
||||
'name' => 'require',
|
||||
'controller' => 'require|unique:security_data_recycle',
|
||||
'data_table' => 'require',
|
||||
'primary_key' => 'require',
|
||||
];
|
||||
|
||||
/**
|
||||
* 验证提示信息
|
||||
* @var array
|
||||
*/
|
||||
protected $message = [];
|
||||
|
||||
/**
|
||||
* 字段描述
|
||||
*/
|
||||
protected $field = [
|
||||
];
|
||||
|
||||
/**
|
||||
* 验证场景
|
||||
*/
|
||||
protected $scene = [
|
||||
'add' => ['name', 'controller', 'data_table', 'primary_key'],
|
||||
'edit' => ['name', 'controller', 'data_table', 'primary_key'],
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->field = [
|
||||
'name' => __('Name'),
|
||||
'controller' => __('Controller'),
|
||||
'data_table' => __('Data Table'),
|
||||
'primary_key' => __('Primary Key'),
|
||||
];
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
50
app/admin/validate/SensitiveData.php
Normal file
50
app/admin/validate/SensitiveData.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class SensitiveData extends Validate
|
||||
{
|
||||
protected $failException = true;
|
||||
|
||||
protected $rule = [
|
||||
'name' => 'require',
|
||||
'controller' => 'require|unique:security_sensitive_data',
|
||||
'data_table' => 'require',
|
||||
'primary_key' => 'require',
|
||||
'data_fields' => 'require',
|
||||
];
|
||||
|
||||
/**
|
||||
* 验证提示信息
|
||||
* @var array
|
||||
*/
|
||||
protected $message = [];
|
||||
|
||||
/**
|
||||
* 字段描述
|
||||
*/
|
||||
protected $field = [
|
||||
];
|
||||
|
||||
/**
|
||||
* 验证场景
|
||||
*/
|
||||
protected $scene = [
|
||||
'add' => ['name', 'data_fields', 'controller', 'data_table', 'primary_key'],
|
||||
'edit' => ['name', 'data_fields', 'controller', 'data_table', 'primary_key'],
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->field = [
|
||||
'name' => __('Name'),
|
||||
'data_fields' => __('Data Fields'),
|
||||
'controller' => __('Controller'),
|
||||
'data_table' => __('Data Table'),
|
||||
'primary_key' => __('Primary Key'),
|
||||
];
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
46
app/admin/validate/UserMoneyLog.php
Normal file
46
app/admin/validate/UserMoneyLog.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class UserMoneyLog extends Validate
|
||||
{
|
||||
protected $failException = true;
|
||||
|
||||
protected $rule = [
|
||||
'user_id' => 'require',
|
||||
'money' => 'require',
|
||||
'memo' => 'require',
|
||||
];
|
||||
|
||||
/**
|
||||
* 验证提示信息
|
||||
* @var array
|
||||
*/
|
||||
protected $message = [];
|
||||
|
||||
/**
|
||||
* 字段描述
|
||||
*/
|
||||
protected $field = [
|
||||
];
|
||||
|
||||
/**
|
||||
* 验证场景
|
||||
*/
|
||||
protected $scene = [
|
||||
'add' => ['user_id', 'money', 'memo'],
|
||||
'edit' => ['user_id', 'money', 'memo'],
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->field = [
|
||||
'user_id' => __('user_id'),
|
||||
'money' => __('money'),
|
||||
'memo' => __('memo'),
|
||||
];
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
46
app/admin/validate/UserScoreLog.php
Normal file
46
app/admin/validate/UserScoreLog.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class UserScoreLog extends Validate
|
||||
{
|
||||
protected $failException = true;
|
||||
|
||||
protected $rule = [
|
||||
'user_id' => 'require',
|
||||
'score' => 'require',
|
||||
'memo' => 'require',
|
||||
];
|
||||
|
||||
/**
|
||||
* 验证提示信息
|
||||
* @var array
|
||||
*/
|
||||
protected $message = [];
|
||||
|
||||
/**
|
||||
* 字段描述
|
||||
*/
|
||||
protected $field = [
|
||||
];
|
||||
|
||||
/**
|
||||
* 验证场景
|
||||
*/
|
||||
protected $scene = [
|
||||
'add' => ['user_id', 'score', 'memo'],
|
||||
'edit' => ['user_id', 'score', 'memo'],
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->field = [
|
||||
'user_id' => __('user_id'),
|
||||
'score' => __('score'),
|
||||
'memo' => __('memo'),
|
||||
];
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user