first commit
This commit is contained in:
@@ -0,0 +1 @@
|
||||
37fbe7a9-70d7-4042-8f14-2d23774bee5e
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/*
|
||||
* 权限验证规则
|
||||
* */
|
||||
namespace app\admin\validate;
|
||||
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class Auth extends Validate {
|
||||
|
||||
/**
|
||||
* 验证规则
|
||||
* @var array
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require|number|checkAuthId',
|
||||
'title' => 'require|max:30',
|
||||
'sort' => 'member',
|
||||
'remark' => 'require|max:250',
|
||||
'auth_id' => 'require',
|
||||
'node_id' => 'require',
|
||||
'field' => 'require',
|
||||
'value' => 'require|max:30',
|
||||
];
|
||||
|
||||
/**
|
||||
* 错误提示
|
||||
* @var array
|
||||
*/
|
||||
protected $message = [
|
||||
'id.require' => '编号必须',
|
||||
'title.require' => '角色权限必须',
|
||||
'id.number' => '编号为数字',
|
||||
'field.require' => '字段必须',
|
||||
'value.require' => '修改值必须',
|
||||
'value.max' => '修改值最多不能超过30个字符',
|
||||
'title.max' => '权限角色名称最多不能超过30个字符',
|
||||
];
|
||||
|
||||
/**
|
||||
* 应用场景
|
||||
* @var array
|
||||
*/
|
||||
protected $scene = [
|
||||
//添加系统角色
|
||||
'add' => ['title'],
|
||||
|
||||
//授权
|
||||
'authorize' => ['auth_id, node_id'],
|
||||
|
||||
//修改系统角色字段值
|
||||
'edit_field' => ['id', 'field', 'value'],
|
||||
|
||||
//删除角色
|
||||
'del' => ['id'],
|
||||
|
||||
//更改角色状态
|
||||
'status' => ['id'],
|
||||
];
|
||||
|
||||
/**
|
||||
* 自定义验证场景
|
||||
* @return Node
|
||||
*/
|
||||
public function sceneEdit() {
|
||||
return $this->only(['id', 'remark', 'title'])
|
||||
->remove('id', 'checkAuthId');
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测ID是否存在
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param array $data
|
||||
* @return bool|string
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @throws \think\exception\DbException
|
||||
*/
|
||||
protected function checkAuthId($value, $rule, $data = []) {
|
||||
$user = \app\admin\model\Auth::where(['id' => $value])->find();
|
||||
if (empty($user)) return '暂无角色数据,请稍后再试!';
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
*公共验证规则
|
||||
*/
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
|
||||
use think\Validate;
|
||||
|
||||
/**
|
||||
* 公共验证规则
|
||||
* Class Common
|
||||
* @package app\admin\validate
|
||||
*/
|
||||
class Common extends Validate {
|
||||
/**
|
||||
* 验证规则
|
||||
* @var array
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require|number',
|
||||
'field' => 'require',
|
||||
'value' => 'require|max:30',
|
||||
];
|
||||
|
||||
/**
|
||||
* 错误提示
|
||||
* @var array
|
||||
*/
|
||||
protected $message = [
|
||||
'id.require' => '编号必须',
|
||||
'field.require' => '字段必须',
|
||||
'value.require' => '修改值必须',
|
||||
];
|
||||
|
||||
/**
|
||||
* 验证场景
|
||||
* @var array
|
||||
*/
|
||||
protected $scene = [
|
||||
//修改字段值
|
||||
'edit_field' => ['id', 'field', 'value'],
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/*
|
||||
* 系统参数验证
|
||||
* */
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
|
||||
use think\Validate;
|
||||
|
||||
/**
|
||||
* 系统参数验证
|
||||
* Class Config
|
||||
* @package app\admin\validate
|
||||
*/
|
||||
class Config extends Validate {
|
||||
|
||||
/**
|
||||
* 验证规则
|
||||
* @var array
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require|number|checkConfigId',
|
||||
'field' => 'require',
|
||||
'value' => 'require|max:250',
|
||||
];
|
||||
|
||||
/**
|
||||
* 错误提示
|
||||
* @var array
|
||||
*/
|
||||
protected $message = [
|
||||
'id.require' => '编号必须',
|
||||
'field.require' => '字段必须',
|
||||
'value.require' => '修改值必须',
|
||||
'value.max' => '修改值最多不能超过250个字符',
|
||||
];
|
||||
|
||||
/**
|
||||
* 应用场景
|
||||
* @var array
|
||||
*/
|
||||
protected $scene = [
|
||||
//修改字段值
|
||||
'edit_field' => ['id', 'field', 'value'],
|
||||
];
|
||||
|
||||
/**
|
||||
* 检测ID是否存在
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param array $data
|
||||
* @return bool|string
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @throws \think\exception\DbException
|
||||
*/
|
||||
protected function checkConfigId($value, $rule, $data = []) {
|
||||
$config = \app\admin\model\Config::where(['id' => $value])->find();
|
||||
if (empty($config)) return '暂无数据,请稍后再试!';
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/*
|
||||
* 登录验证
|
||||
* */
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
use think\captcha\Captcha;
|
||||
|
||||
/**
|
||||
* 后台登录验证类
|
||||
* Class Login
|
||||
* @package app\admin\validate
|
||||
*/
|
||||
class Login extends Validate {
|
||||
|
||||
/**
|
||||
* 验证规则
|
||||
* @var array
|
||||
*/
|
||||
protected $rule = [
|
||||
'username' => 'require|max:15',
|
||||
'password' => 'require|max:20',
|
||||
'vercode' => 'require|captcha',
|
||||
];
|
||||
|
||||
/**
|
||||
* 错误提示
|
||||
* @var array
|
||||
*/
|
||||
protected $message = [
|
||||
'username.require' => '登录名必须',
|
||||
'username.max' => '登录名最多不能超过15个字符',
|
||||
'password.require' => '密码必须',
|
||||
'password.max' => '密码最多不能超过20个字符',
|
||||
'vercode.require' => '验证码不能为空',
|
||||
'vercode.captcha' => '验证码不正确,请重新输入',
|
||||
];
|
||||
|
||||
/**
|
||||
* 应用场景
|
||||
* @var array
|
||||
*/
|
||||
protected $scene = [
|
||||
//开启验证码登录
|
||||
'index_on' => ['username', 'password', 'vercode'],
|
||||
|
||||
//关闭验证码登录
|
||||
'index_off' => ['username', 'password'],
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/*
|
||||
* 菜单验证规则
|
||||
* */
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
/**
|
||||
* 菜单管理验证类
|
||||
* Class Menu
|
||||
* @package app\admin\validate
|
||||
*/
|
||||
class Menu extends Validate {
|
||||
|
||||
/**
|
||||
* 验证规则
|
||||
* @var array
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require|number|checkId',
|
||||
'pid' => 'require|number',
|
||||
'title' => 'require|max:10',
|
||||
'href' => 'max:100',
|
||||
'icon' => 'max:20',
|
||||
'sort' => 'max:10|number',
|
||||
'status' => 'require|in:0,1',
|
||||
'remark' => 'max:250',
|
||||
'field' => 'require',
|
||||
'value' => 'require|max:30',
|
||||
];
|
||||
|
||||
/**
|
||||
* 错误提示
|
||||
* @var array
|
||||
*/
|
||||
protected $message = [
|
||||
'pid.require' => '上级菜单必须',
|
||||
'pid.number' => '上级菜单数据有误',
|
||||
'title.require' => '菜单名称必须',
|
||||
'title.max' => '名称最多不能超过10个字符',
|
||||
'href.max' => '链接最多不能超过100个字符',
|
||||
'status.in' => '启用状态格式有误',
|
||||
'sort.number' => '排序必须为数字',
|
||||
'field.require' => '字段必须',
|
||||
'value.require' => '修改值必须',
|
||||
];
|
||||
|
||||
/**
|
||||
* 应用场景
|
||||
* @var array
|
||||
*/
|
||||
protected $scene = [
|
||||
//添加菜单
|
||||
'add' => ['pid', 'title', 'href', 'icon', 'sort', 'remark'],
|
||||
|
||||
//修改菜单
|
||||
'edit' => ['id', 'pid', 'title', 'href', 'icon', 'sort', 'remark'],
|
||||
|
||||
//删除菜单
|
||||
'del' => ['id'],
|
||||
|
||||
//更改菜单状态
|
||||
'status' => ['id'],
|
||||
|
||||
//修改字段值
|
||||
'edit_field' => ['id', 'field', 'value'],
|
||||
];
|
||||
|
||||
/**
|
||||
* 检测菜单是否存在
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param array $data
|
||||
* @return bool|string
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @throws \think\exception\DbException
|
||||
*/
|
||||
protected function checkId($value, $rule, $data = []) {
|
||||
$menu = \app\admin\model\menu::where(['id' => $value])->find();
|
||||
if (empty($menu)) return '暂无菜单数据,请稍后再试!';
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
/*
|
||||
* 系统节点验证
|
||||
* */
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class Node extends Validate {
|
||||
/**
|
||||
* 验证规则
|
||||
* @var array
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require|number|checkNodeId',
|
||||
'field' => 'require',
|
||||
'value' => 'require|max:30',
|
||||
'node' => 'require|checkNode',
|
||||
'title' => 'require|max:30',
|
||||
];
|
||||
|
||||
/**
|
||||
* 错误提示
|
||||
* @var array
|
||||
*/
|
||||
protected $message = [
|
||||
'id.require' => '编号必须',
|
||||
'node.require' => '系统节点必须',
|
||||
'id.number' => '编号为数字',
|
||||
'field.require' => '字段必须',
|
||||
'value.require' => '修改值必须',
|
||||
'value.max' => '修改值最多不能超过30个字符',
|
||||
'title.max' => '修改值最多不能超过30个字符',
|
||||
];
|
||||
|
||||
/**
|
||||
* 应用场景
|
||||
* @var array
|
||||
*/
|
||||
protected $scene = [
|
||||
//添加系统节点
|
||||
'add' => ['node', 'title'],
|
||||
|
||||
//修改系统节点字段值
|
||||
'edit_field' => ['id', 'field', 'value'],
|
||||
|
||||
//删除节点
|
||||
'del' => ['id'],
|
||||
|
||||
//更改节点状态
|
||||
'status' => ['id'],
|
||||
];
|
||||
|
||||
/**
|
||||
* 自定义验证场景
|
||||
* @return Node
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','node','title'])
|
||||
->remove('node', 'checkNode');
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测节点id是否存在
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param array $data
|
||||
* @return bool|string
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @throws \think\exception\DbException
|
||||
*/
|
||||
protected function checkNodeId($value, $rule, $data = []) {
|
||||
$user = \app\admin\model\node::where(['id' => $value])->find();
|
||||
if (empty($user)) return '暂无节点数据,请稍后再试!';
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测系统节点是否存在
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param array $data
|
||||
* @return bool|string
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @throws \think\exception\DbException
|
||||
*/
|
||||
protected function checkNode($value, $rule, $data = []) {
|
||||
$user = \app\admin\model\node::where(['node' => $value])->find();
|
||||
if (!empty($user)) return '已存在该系统节点,无需再次添加!';
|
||||
return true;
|
||||
}
|
||||
}
|
||||
218
芳林公司项目/www.zhiyuanhelp.com/application/admin/validate/User.php
Normal file
218
芳林公司项目/www.zhiyuanhelp.com/application/admin/validate/User.php
Normal file
@@ -0,0 +1,218 @@
|
||||
<?php
|
||||
/*
|
||||
* 后台管理员验证
|
||||
* */
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
|
||||
/**
|
||||
* 后台管理员验证类
|
||||
* Class User
|
||||
* @package app\admin\validate
|
||||
*/
|
||||
class User extends Validate {
|
||||
|
||||
/**
|
||||
* 验证规则
|
||||
* @var array
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require|number|checkDelId',
|
||||
'head_img' => 'require',
|
||||
'username' => 'require|min:5|max:15|checkUsername',
|
||||
'old_password' => 'require|min:6|max:20|checkOldPassword',
|
||||
'password' => 'require|min:6|max:20|checkPassword',
|
||||
'password1' => 'require|min:6|max:20|checkPassword',
|
||||
'phone' => 'require|number|mobile|checkPhone',
|
||||
'mail' => 'email|max:20|checkMail',
|
||||
'auth_id' => 'require',
|
||||
'qq' => 'number',
|
||||
'remark' => 'max:250',
|
||||
];
|
||||
|
||||
/**
|
||||
* 错误提示
|
||||
* @var array
|
||||
*/
|
||||
protected $message = [
|
||||
'id.require' => '编号必须',
|
||||
'username.require' => '名称必须',
|
||||
'head_img.require' => '头像必须',
|
||||
'username.min' => '名称不能少于5个字符',
|
||||
'username.max' => '名称最多不能超过15个字符',
|
||||
'password.require' => '密码必须',
|
||||
'password.min' => '密码不能少于6个字符',
|
||||
'password.max' => '密码最多不能超过20个字符',
|
||||
'password1.require' => '第二次密码必须',
|
||||
'password1.max' => '第二次密码最多不能超过20个字符',
|
||||
'auth_id.number' => '角色编号必须是数字',
|
||||
'mail.email' => '邮箱格式错误',
|
||||
'phone.email' => '手机号格式错误',
|
||||
'qq.number' => 'QQ必须为数字',
|
||||
'remark.max' => '备注最多不能超过250个字符',
|
||||
];
|
||||
|
||||
/**
|
||||
* 应用场景
|
||||
* @var array
|
||||
*/
|
||||
protected $scene = [
|
||||
//添加管理员
|
||||
'add' => ['username', 'password', 'password1', 'phone', 'mail', 'auth_id', 'qq', 'remark'],
|
||||
|
||||
//修改管理员
|
||||
'edit' => ['username', 'phone', 'mail', 'auth_id', 'qq', 'remark'],
|
||||
|
||||
//修改登录密码
|
||||
'edit_password' => ['id', 'password', 'password1'],
|
||||
|
||||
//删除管理员
|
||||
'del' => ['id'],
|
||||
|
||||
//更改管理员状态
|
||||
'status' => ['id'],
|
||||
];
|
||||
|
||||
/**
|
||||
* 修改信息验证场景
|
||||
* @return User
|
||||
*/
|
||||
public function sceneEdit() {
|
||||
return $this->only(['head_img', 'phone', 'mail', 'auth_id'])
|
||||
->remove('phone', 'checkPhone')
|
||||
->remove('mail', 'checkMail');
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改自己的信息
|
||||
* @return User
|
||||
*/
|
||||
public function sceneEditSelf() {
|
||||
return $this->only(['head_img', 'phone', 'mail', 'remark'])
|
||||
->remove('phone', 'checkPhone')
|
||||
->remove('mail', 'checkMail');
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测删除时用户ID
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param array $data
|
||||
* @return bool|string
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @throws \think\exception\DbException
|
||||
*/
|
||||
protected function checkDelId($value, $rule, $data = []) {
|
||||
$user = \app\admin\model\user::where(['id' => $value])->find();
|
||||
if (empty($user)) return '暂无账户数据,请稍后再试!';
|
||||
if ($user['is_deleted'] == 1) return '该账户已被删除,无需再次删除!';
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测启用或者禁用时的用户ID
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param array $data
|
||||
* @return bool|string
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @throws \think\exception\DbException
|
||||
*/
|
||||
protected function checkOperateId($value, $rule, $data = []) {
|
||||
$user = \app\admin\model\user::where(['id' => $value])->find();
|
||||
if (empty($user)) return '暂无账户数据,请稍后再试!';
|
||||
if ($user['is_deleted'] == 1) return '该账户已被删除,无需再次删除!';
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查用户名是否已存在
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param array $data
|
||||
* @return bool|string
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @throws \think\exception\DbException
|
||||
*/
|
||||
protected function checkUsername($value, $rule, $data = []) {
|
||||
$where_user = [
|
||||
'username' => $value,
|
||||
'status' => 1,
|
||||
'is_deleted' => 0,
|
||||
];
|
||||
$user = \app\admin\model\user::where($where_user)->find();
|
||||
return empty($user) ? true : '已有相同登录账号,请更换进行注册!';
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断两个输入的密码是否一致
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param array $data
|
||||
* @return bool|string
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @throws \think\exception\DbException
|
||||
*/
|
||||
protected function checkPassword($value, $rule, $data = []) {
|
||||
return $data['password'] == $data['password1'] ? true : '两次输入的密码不一致,请重新输入!';
|
||||
}
|
||||
|
||||
protected function checkOldPassword($value, $rule, $data = []) {
|
||||
$where_user = [
|
||||
'id' => $data['id'],
|
||||
'status' => 1,
|
||||
'is_deleted' => 0,
|
||||
];
|
||||
$user = \app\admin\model\user::where($where_user)->find();
|
||||
if (empty($user)) return '暂无改管理员信息,请刷新重试!';
|
||||
return $user['password'] == password($value) ? true : '旧密码不正确,请重新输入!';
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否存在相同的手机号
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param array $data
|
||||
* @return bool|string
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @throws \think\exception\DbException
|
||||
*/
|
||||
protected function checkPhone($value, $rule, $data = []) {
|
||||
$where_user = [
|
||||
'phone' => $value,
|
||||
'status' => 1,
|
||||
'is_deleted' => 0,
|
||||
];
|
||||
$user = \app\admin\model\user::where($where_user)->find();
|
||||
return empty($user) ? true : '已有相同手机号码,请更换进行注册!';
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否存在相同的邮箱
|
||||
* @param $value
|
||||
* @param $rule
|
||||
* @param array $data
|
||||
* @return bool|string
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @throws \think\exception\DbException
|
||||
*/
|
||||
protected function checkMail($value, $rule, $data = []) {
|
||||
$where_user = [
|
||||
'mail' => $value,
|
||||
'status' => 1,
|
||||
'is_deleted' => 0,
|
||||
];
|
||||
$user = \app\admin\model\user::where($where_user)->find();
|
||||
return empty($user) ? true : '已有相同邮箱,请更换进行注册!';
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
c680dcfe-9dbd-441e-b1b2-418eecefa5dd
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Administrator
|
||||
* Date: 2020/4/24
|
||||
* Time: 16:17
|
||||
*/
|
||||
|
||||
namespace app\admin\validate\custom;
|
||||
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class Message extends Validate
|
||||
{
|
||||
/**
|
||||
* 验证规则
|
||||
* @var array
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require|number',
|
||||
'replyCon' => 'require'
|
||||
];
|
||||
|
||||
/**
|
||||
* 错误提示
|
||||
* @var array
|
||||
*/
|
||||
protected $message = [
|
||||
'id.require' => '编号必须',
|
||||
'id.number' => '编号为数字',
|
||||
'replyCon.require' => '请输入回复内容',
|
||||
|
||||
];
|
||||
|
||||
/**
|
||||
* 应用场景
|
||||
* @var array
|
||||
*/
|
||||
protected $scene = [
|
||||
|
||||
//授权
|
||||
'reply' => ['id','replyCon'],
|
||||
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Administrator
|
||||
* Date: 2020/4/25
|
||||
* Time: 18:26
|
||||
*/
|
||||
|
||||
namespace app\admin\validate\custom;
|
||||
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class Proscore extends Validate
|
||||
{
|
||||
/**
|
||||
* 验证规则
|
||||
* @var array
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require|number',
|
||||
'province_id' => 'require|number',
|
||||
'province_title' => 'require',
|
||||
'year' => 'require',
|
||||
'GaoKaoTotal' => 'require|number',
|
||||
'ArtsScore' => 'require|number',
|
||||
'SciencesScore' => 'require|number',
|
||||
'batch' => 'require|number',
|
||||
'batchName' => 'require',
|
||||
];
|
||||
|
||||
/**
|
||||
* 错误提示
|
||||
* @var array
|
||||
*/
|
||||
protected $message = [
|
||||
'id.require' => '编号必须',
|
||||
'province_id.number' => '省份id必须为数字',
|
||||
'GaoKaoTotal.number' => '高考总分必须为数字',
|
||||
'ArtsScore.require' => '文科分数必填',
|
||||
'ArtsScore.number' => '文科分数必须为数字',
|
||||
'batch.require' => '批次序列必须',
|
||||
'batch.number' => '批次序列必须数字',
|
||||
'SciencesScore.require' => '理科分数必须',
|
||||
'SciencesScore.number' => '理科分数必须为数字',
|
||||
|
||||
|
||||
|
||||
];
|
||||
|
||||
/**
|
||||
* 应用场景
|
||||
* @var array
|
||||
*/
|
||||
protected $scene = [
|
||||
|
||||
'add' => ['province_id','province_title','batch','batchName','ArtsScore','GaoKaoTotal','SciencesScore','year'],
|
||||
'edit' => ['id'],
|
||||
'del' => ['id']
|
||||
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Administrator
|
||||
* Date: 2020/4/23
|
||||
* Time: 18:58
|
||||
*/
|
||||
|
||||
namespace app\admin\validate\custom;
|
||||
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class Student extends Validate
|
||||
{
|
||||
/**
|
||||
* 验证规则
|
||||
* @var array
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require|number',
|
||||
'reason' => 'require|max:200'
|
||||
];
|
||||
|
||||
/**
|
||||
* 错误提示
|
||||
* @var array
|
||||
*/
|
||||
protected $message = [
|
||||
'id.require' => '编号必须',
|
||||
'id.number' => '编号为数字',
|
||||
'reason.require' => '退款原因必须',
|
||||
'reason.max' => '退款原因最多不能超过200个字符'
|
||||
];
|
||||
|
||||
/**
|
||||
* 应用场景
|
||||
* @var array
|
||||
*/
|
||||
protected $scene = [
|
||||
|
||||
//授权
|
||||
'refundOrder' => ['id','reason'],
|
||||
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user