36 lines
1.3 KiB
PHP
36 lines
1.3 KiB
PHP
<?php
|
|
namespace app\project\validate;
|
|
use think\Validate;
|
|
use think\facade\Db;
|
|
|
|
class ProjectCheck extends Validate
|
|
{
|
|
protected $rule = [
|
|
'name' => 'require|unique:project',
|
|
'start_time' => 'require',
|
|
'end_time' => 'require',
|
|
'director_uid' => 'require',
|
|
'content' => 'require',
|
|
'code' => 'alphaNum|length:5,10|unique:project',
|
|
'id' => 'require'
|
|
];
|
|
|
|
protected $message = [
|
|
'name.require' => '项目名称不能为空',
|
|
'name.unique' => '项目已存在',
|
|
'start_time.require' => '项目开始时间不能为空',
|
|
'end_time.require' => '项目结束时间不能为空',
|
|
'director_uid.require' => '项目负责人不能为空',
|
|
'content.require' => '项目简介不能为空',
|
|
'code.alphaNum' => '项目代码只能为5至10为字母和数字',
|
|
'code.length' => '项目代码只能为5至10为字母和数字',
|
|
'code.unique' => '同样的项目代码已经存在',
|
|
'id.require' => '缺少更新条件',
|
|
];
|
|
|
|
protected $scene = [
|
|
'add' => ['name','start_time','end_time','director_uid','content','code'],
|
|
'edit' => ['id']
|
|
];
|
|
|
|
} |