www.maiwd.cn // +---------------------------------------------------------------------- namespace app\admin\validate\wdsxh\message; use think\Validate; /** * 消息通知验证器 */ class MessageNotification extends Validate { /** * 验证规则 */ protected $rule = [ 'member_id' => 'require', 'type' => 'require|in:1,2,3', 'title' => 'require|max:255', 'content' => 'require', ]; /** * 提示消息 */ protected $message = [ 'member_id.require' => '会员ID不能为空', 'type.require' => '消息类型不能为空', 'type.in' => '消息类型必须为:1=活动通知,2=审核通知,3=系统通知', 'title.require' => '消息标题不能为空', 'title.max' => '消息标题最多不能超过255个字符', 'content.require' => '消息内容不能为空', ]; /** * 验证场景 */ protected $scene = [ 'add' => ['member_id', 'type', 'title', 'content'], 'edit' => ['type', 'title', 'content'], ]; }