first commit
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Author 勾股工作室 <hdm58@qq.com>
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
namespace app\home\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class ConfCheck extends Validate
|
||||
{
|
||||
protected $rule = [
|
||||
'title' => 'require|unique:config',
|
||||
'name' => 'require|unique:config',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'title.require' => '配置名称不能为空',
|
||||
'title.unique' => '同样的配置名称已经存在',
|
||||
'name.require' => '配置标识不能为空',
|
||||
'name.unique' => '同样的配置标识已经存在',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Author 勾股工作室 <hdm58@qq.com>
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
namespace app\home\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class EnterpriseCheck extends Validate
|
||||
{
|
||||
protected $rule = [
|
||||
'title' => 'require|unique:enterprise',
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'title.require' => '名称不能为空',
|
||||
'title.unique' => '同样的名称已经存在',
|
||||
'id.require' => '缺少更新条件',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['title'],
|
||||
'edit' => ['id', 'title'],
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Author 勾股工作室 <hdm58@qq.com>
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
namespace app\home\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class GroupCheck extends Validate
|
||||
{
|
||||
protected $rule = [
|
||||
'title' => 'require|unique:admin_group',
|
||||
'id' => 'require',
|
||||
'status' => 'require|checkStatus:-1,1',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'title.require' => '名称不能为空',
|
||||
'title.unique' => '同样的记录已经存在',
|
||||
'id.require' => '缺少更新条件',
|
||||
'status.require' => '状态为必选',
|
||||
'status.checkStatus' => '系统所有者组不能被禁用',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['title', 'status'],
|
||||
'edit' => ['id', 'title', 'status'],
|
||||
];
|
||||
|
||||
// 自定义验证规则
|
||||
protected function checkStatus($value, $rule, $data)
|
||||
{
|
||||
if ($value == -1 and $data['id'] == 1) {
|
||||
return $rule == false;
|
||||
}
|
||||
return $rule == true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Author 勾股工作室 <hdm58@qq.com>
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
namespace app\home\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class ModuleCheck extends Validate
|
||||
{
|
||||
protected $rule = [
|
||||
'title' => 'require|unique:admin_module',
|
||||
'name' => 'require|lower|min:2|unique:admin_module',
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'title.require' => '模块名称不能为空',
|
||||
'title.unique' => '同样的模块名称已经存在',
|
||||
'name.require' => '模块标识不能为空',
|
||||
'name.lower' => '模块目录只能是小写字母',
|
||||
'name.min' => '模块目录至少需要2个小写字母',
|
||||
'name.unique' => '同样的模块目录已经存在',
|
||||
'id.require' => '缺少更新条件',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['title','name'],
|
||||
'edit' => ['id','title','name'],
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Author 勾股工作室 <hdm58@qq.com>
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
namespace app\home\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class RuleCheck extends Validate
|
||||
{
|
||||
protected $rule = [
|
||||
'title' => 'require',
|
||||
'name' => 'require',
|
||||
'menu' => 'require',
|
||||
'src' => 'unique:admin_rule',
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'title.require' => '菜单节点名称不能为空',
|
||||
'src.unique' => '同样的菜单节点URL已经存在',
|
||||
'menu.require' => '是否是左侧菜单需要选择',
|
||||
'name.require' => '节点日志操作名称不能为空',
|
||||
'id.require' => '缺少更新条件'
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['title','src','name','menu'],
|
||||
'edit' => ['id', 'title','src','name','menu']
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Author 勾股工作室 <hdm58@qq.com>
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
namespace app\home\validate;
|
||||
use think\Validate;
|
||||
use think\facade\Db;
|
||||
|
||||
class TemplateValidate extends Validate
|
||||
{
|
||||
// 自定义验证规则
|
||||
protected function checkOne($value,$rule,$data=[])
|
||||
{
|
||||
$id = isset($data['id'])?$data['id']:0;
|
||||
$count = Db::name('Template')->where([['title','=',$data['title']],['id','<>',$id],['delete_time','=',0]])->count();
|
||||
return $count == 0 ? true : false;
|
||||
}
|
||||
protected function checkOneName($value,$rule,$data=[])
|
||||
{
|
||||
$id = isset($data['id'])?$data['id']:0;
|
||||
$count = Db::name('Template')->where([['name','=',$data['name']],['id','<>',$id],['delete_time','=',0]])->count();
|
||||
return $count == 0 ? true : false;
|
||||
}
|
||||
|
||||
protected $rule = [
|
||||
'title' => 'require|checkOne',
|
||||
'name' => 'require|alphaDash|checkOneName',
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'title.require' => '名称不能为空',
|
||||
'title.checkOne' => '同样的名称已经存在',
|
||||
'name.checkOne' => '同样的标识已经存在',
|
||||
'name.alphaDash' => '标识只能是小写字母',
|
||||
'id.require' => '缺少更新条件',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['title','name'],
|
||||
'edit' => ['title','name', 'id'],
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Author 勾股工作室 <hdm58@qq.com>
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
namespace app\home\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class UserCheck extends Validate
|
||||
{
|
||||
protected $rule = [
|
||||
'username' => 'require',
|
||||
'password' => 'require',
|
||||
'captcha' => 'require|captcha',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'username.require' => '用户名不能为空',
|
||||
'password.require' => '密码不能为空',
|
||||
'captcha.require' => '验证码不能为空',
|
||||
'captcha.captcha' => '验证码不正确',
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user