31 lines
881 B
PHP
31 lines
881 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
namespace app\backend\validate;
|
|
|
|
use think\Validate;
|
|
|
|
class Notice extends Validate
|
|
{
|
|
protected $rule = [
|
|
'title' => 'require|max:200',
|
|
'content' => 'require',
|
|
'author' => 'max:50',
|
|
'type' => 'in:1,2,3,4',
|
|
'is_top' => 'in:0,1',
|
|
'start_time' => 'integer',
|
|
'end_time' => 'integer',
|
|
'sort' => 'number',
|
|
'status' => 'in:0,1',
|
|
];
|
|
|
|
protected $message = [
|
|
'title.require' => '请输入公告标题',
|
|
'content.require' => '请输入公告内容',
|
|
'type.in' => '公告类型不正确',
|
|
];
|
|
|
|
protected $scene = [
|
|
'add' => ['title', 'content', 'author', 'type', 'is_top', 'start_time', 'end_time', 'sort', 'status'],
|
|
'edit' => ['title', 'content', 'author', 'type', 'is_top', 'start_time', 'end_time', 'sort', 'status'],
|
|
];
|
|
} |