first commit
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
/**
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Author 勾股工作室 <hdm58@qq.com>
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
namespace app\user\validate;
|
||||
use think\facade\Db;
|
||||
use think\Validate;
|
||||
|
||||
class AdminCheck extends Validate
|
||||
{
|
||||
protected $regex = [ 'checkUser' => '/^[A-Za-z]{1}[A-Za-z0-9_-]{3,19}$/'];
|
||||
// 自定义验证规则
|
||||
protected function checkUnique($value, $rule, $data)
|
||||
{
|
||||
[$table, $field, $id] = explode(',', $rule);
|
||||
$idField = $id ?: 'id';
|
||||
$idValue = $data[$idField] ?? null;
|
||||
$map = [
|
||||
[$field, '=', $value],
|
||||
];
|
||||
if (!is_null($idValue)) {
|
||||
$map[] = [$idField, '<>', $idValue];
|
||||
}
|
||||
$map[] = ['status', 'in', [0,1]];
|
||||
$map[] = ['delete_time', '=', 0];
|
||||
return !Db::name($table)->where($map)->count();
|
||||
}
|
||||
|
||||
protected $rule = [
|
||||
'name' => 'require|chs',
|
||||
'username' => 'require|regex:checkUser',
|
||||
'mobile' => 'require|mobile|checkUnique:Admin,mobile,id',
|
||||
'email' => 'require|email|checkUnique:Admin,email,id',
|
||||
'reg_pwd' => 'require|min:6',
|
||||
'did' => 'require',
|
||||
'position_id' => 'require',
|
||||
'type' => 'require',
|
||||
'entry_time' => 'require',
|
||||
'id' => 'require',
|
||||
'pwd' => 'require|min:6|confirm',
|
||||
'old_pwd' => 'require|different:pwd',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'name.require' => '员工姓名不能为空',
|
||||
'name.chs' => '员工姓名只能是汉字',
|
||||
'username.require' => '登录账号不能为空',
|
||||
'username.regex' => '登录账号必须是以字母开头,只能包含字母数字下划线和减号,4到20位',
|
||||
'mobile.require' => '手机不能为空',
|
||||
'mobile.mobile' => '手机格式错误',
|
||||
'mobile.checkUnique' => '同样的手机号码已经存在,请检查一下是否被离职或者禁用员工占用',
|
||||
'email.require' => '邮箱不能为空',
|
||||
'email.email' => '邮箱格式错误',
|
||||
'email.checkUnique' => '同样的邮箱已经存在,请检查一下是否被离职或者禁用员工占用',
|
||||
'reg_pwd.require' => '密码不能为空',
|
||||
'reg_pwd.min' => '密码至少要6个字符',
|
||||
'did.require' => '请选择所在部门',
|
||||
'position_id.require' => '请选择职位',
|
||||
'type.require' => '请选择员工类型',
|
||||
'entry_time.require' => '请选择入职时间',
|
||||
'id.require' => '缺少更新条件',
|
||||
'pwd.require' => '密码不能为空',
|
||||
'pwd.min' => '密码至少要6个字符',
|
||||
'pwd.confirm' => '两次密码不一致',
|
||||
'old_pwd.require' => '请提供旧密码',
|
||||
'old_pwd.different' => '新密码不能和旧密码一样',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['name', 'username', 'mobile','email','reg_pwd', 'did', 'position_id', 'type', 'entry_time'],
|
||||
'edit' => ['name', 'mobile','email', 'did', 'position_id', 'entry_time', 'id'],
|
||||
'editPwd' => ['old_pwd', 'pwd'],
|
||||
];
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Author 勾股工作室 <hdm58@qq.com>
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
namespace app\user\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class BasicUserCheck extends Validate
|
||||
{
|
||||
protected $rule = [
|
||||
'title' => 'require',
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'title.require' => '名称不能为空',
|
||||
'id.require' => '缺少更新条件',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['title'],
|
||||
'edit' => ['id', 'title'],
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Author 勾股工作室 <hdm58@qq.com>
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
namespace app\user\validate;
|
||||
use think\Validate;
|
||||
use think\facade\Db;
|
||||
|
||||
class BlacklistValidate extends Validate
|
||||
{
|
||||
// 自定义验证规则
|
||||
protected function checkOne($value,$rule,$data=[])
|
||||
{
|
||||
$id = isset($data['id'])?$data['id']:0;
|
||||
$count_a = Db::name('Blacklist')->where([['idcard','=',$data['idcard']],['id','<>',$id],['delete_time','=',0]])->count();
|
||||
$count_b = Db::name('Blacklist')->where([['mobile','=',$data['mobile']],['id','<>',$id],['delete_time','=',0]])->count();
|
||||
if($count_a>0 || $count_b>0){
|
||||
return false;
|
||||
}
|
||||
else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
protected $rule = [
|
||||
'name' => 'require',
|
||||
'mobile' => 'require|checkOne',
|
||||
'idcard' => 'checkOne',
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'name.require' => '姓名不能为空',
|
||||
'mobile.require' => '手机号码不能为空',
|
||||
'mobile.checkOne' => '同样的手机号码已经存在',
|
||||
'idcard.checkOne' => '同样的身份证号码已经存在',
|
||||
'id.require' => '缺少更新条件',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['name','idcard'],
|
||||
'edit' => ['name','idcard', 'id'],
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Author 勾股工作室 <hdm58@qq.com>
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
namespace app\user\validate;
|
||||
use think\Validate;
|
||||
use think\facade\Db;
|
||||
|
||||
class CareCateValidate extends Validate
|
||||
{
|
||||
// 自定义验证规则
|
||||
protected function checkOne($value,$rule,$data=[])
|
||||
{
|
||||
$count = Db::name('CareCate')->where([['title','=',$data['title']],['id','<>',$data['id']]])->count();
|
||||
return $count == 0 ? true : false;
|
||||
}
|
||||
|
||||
protected $rule = [
|
||||
'title' => 'require|checkOne',
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'title.require' => '名称不能为空',
|
||||
'title.checkOne' => '同样的名称已经存在',
|
||||
'id.require' => '缺少更新条件',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['title'],
|
||||
'edit' => ['title', 'id'],
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Author 勾股工作室 <hdm58@qq.com>
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
namespace app\user\validate;
|
||||
use think\Validate;
|
||||
use think\facade\Db;
|
||||
|
||||
class CareValidate extends Validate
|
||||
{
|
||||
protected $rule = [
|
||||
'uid' => 'require',
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'title.require' => '员工不能为空',
|
||||
'id.require' => '缺少更新条件',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['uid'],
|
||||
'edit' => ['uid', 'id'],
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Author 勾股工作室 <hdm58@qq.com>
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
namespace app\user\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class DepartmentCheck extends Validate
|
||||
{
|
||||
protected $rule = [
|
||||
'title' => 'require',
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'title.require' => '部门名称不能为空',
|
||||
'id.require' => '缺少更新条件',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['title'],
|
||||
'edit' => ['id', 'title'],
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Author 勾股工作室 <hdm58@qq.com>
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
namespace app\user\validate;
|
||||
use think\Validate;
|
||||
use think\facade\Db;
|
||||
|
||||
class LaborContractValidate extends Validate
|
||||
{
|
||||
// 自定义验证规则
|
||||
protected function checkOne($value,$rule,$data=[])
|
||||
{
|
||||
$count = Db::name('LaborContract')->where([['code','=',$data['code']],['id','<>',$data['id']],['delete_time','=',0]])->count();
|
||||
return $count == 0 ? true : false;
|
||||
}
|
||||
|
||||
protected $rule = [
|
||||
'code' => 'require|checkOne',
|
||||
'title' => 'require',
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'code.require' => '合同编码不能为空',
|
||||
'code.checkOne' => '同样的合同编码已经存在',
|
||||
'title' => '合同名称不能为空',
|
||||
'id.require' => '缺少更新条件',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['code','title'],
|
||||
'edit' => ['code','title', 'id'],
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/**
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Author 勾股工作室 <hdm58@qq.com>
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
namespace app\user\validate;
|
||||
use think\facade\Db;
|
||||
use think\Validate;
|
||||
|
||||
class PositionCheck extends Validate
|
||||
{
|
||||
// 自定义验证规则
|
||||
protected function checkUnique($value, $rule, $data)
|
||||
{
|
||||
[$table, $field, $id] = explode(',', $rule);
|
||||
$idField = $id ?: 'id';
|
||||
$idValue = $data[$idField] ?? null;
|
||||
$map = [
|
||||
[$field, '=', $value],
|
||||
];
|
||||
if (!is_null($idValue)) {
|
||||
$map[] = [$idField, '<>', $idValue];
|
||||
}
|
||||
$map[] = ['status', '=', 1];
|
||||
return !Db::name($table)->where($map)->count();
|
||||
}
|
||||
protected $rule = [
|
||||
'title' => 'require|checkUnique:Position,title,id',
|
||||
'work_price' => 'require|number',
|
||||
'group_id' => 'require',
|
||||
'id' => 'require'
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'title.require' => '岗位名称不能为空',
|
||||
'title.checkUnique' => '同样的岗位名称已经存在',
|
||||
'work_price.require' => '岗位工时单价不能为空',
|
||||
'work_price.number' => '岗位工时单价只能是整数',
|
||||
'group_id.require' => '至少要选择一个角色权限',
|
||||
'id.require' => '缺少更新条件',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['title', 'work_price', 'group_id'],
|
||||
'edit' => ['title', 'work_price', 'group_id', 'id'],
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Author 勾股工作室 <hdm58@qq.com>
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
namespace app\user\validate;
|
||||
use think\Validate;
|
||||
use think\facade\Db;
|
||||
|
||||
class RewardsCateValidate extends Validate
|
||||
{
|
||||
// 自定义验证规则
|
||||
protected function checkOne($value,$rule,$data=[])
|
||||
{
|
||||
$count = Db::name('RewardsCate')->where([['title','=',$data['title']],['id','<>',$data['id']]])->count();
|
||||
return $count == 0 ? true : false;
|
||||
}
|
||||
|
||||
protected $rule = [
|
||||
'title' => 'require|checkOne',
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'title.require' => '名称不能为空',
|
||||
'title.checkOne' => '同样的名称已经存在',
|
||||
'id.require' => '缺少更新条件',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['title'],
|
||||
'edit' => ['title', 'id'],
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Author 勾股工作室 <hdm58@qq.com>
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
namespace app\user\validate;
|
||||
use think\Validate;
|
||||
use think\facade\Db;
|
||||
|
||||
class RewardsValidate extends Validate
|
||||
{
|
||||
protected $rule = [
|
||||
'uid' => 'require',
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'title.require' => '员工不能为空',
|
||||
'id.require' => '缺少更新条件',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['uid'],
|
||||
'edit' => ['uid', 'id'],
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/**
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Author 勾股工作室 <hdm58@qq.com>
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
namespace app\user\validate;
|
||||
use think\Validate;
|
||||
use think\facade\Db;
|
||||
|
||||
class Talent extends Validate
|
||||
{
|
||||
// 自定义验证规则
|
||||
protected function checkUnique($value, $rule, $data)
|
||||
{
|
||||
[$table, $field, $id] = explode(',', $rule);
|
||||
$idField = $id ?: 'id';
|
||||
$idValue = $data[$idField] ?? null;
|
||||
$map = [
|
||||
[$field, '=', $value],
|
||||
];
|
||||
if (!is_null($idValue)) {
|
||||
$map[] = [$idField, '<>', $idValue];
|
||||
}
|
||||
$map[] = ['status', '=', 1];
|
||||
return !Db::name($table)->where($map)->count();
|
||||
}
|
||||
|
||||
protected $rule = [
|
||||
'name' => 'require|chs',
|
||||
'mobile' => 'require|mobile|checkUnique:Admin,mobile,id',
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'name.require' => '员工姓名不能为空',
|
||||
'name.chs' => '员工姓名只能是汉字',
|
||||
'mobile.require' => '手机不能为空',
|
||||
'mobile.mobile' => '手机号码格式错误',
|
||||
'mobile.checkUnique' => '同样的手机号码已经存在入职员工内,请与人事核对后再申请',
|
||||
'id.require' => '缺少更新条件',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['name', 'mobile'],
|
||||
'edit' => ['name', 'mobile','id'],
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user