51 lines
1.9 KiB
PHP
51 lines
1.9 KiB
PHP
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | YwxApp [ WE CAN DO IT JUST THINK ]
|
|
// +----------------------------------------------------------------------
|
|
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
|
|
// +----------------------------------------------------------------------
|
|
// | Author: ywxapp<admin@ywxapp.cn>
|
|
// +----------------------------------------------------------------------
|
|
declare (strict_types = 1);
|
|
|
|
namespace addon\haonav\validate;
|
|
|
|
use think\Validate;
|
|
|
|
/**
|
|
* Link 类
|
|
*
|
|
* @author ywxapp <admin@ywxapp.cn>
|
|
*/
|
|
class Link extends Validate
|
|
{
|
|
protected $rule = [
|
|
'title' => 'require|max:100',
|
|
'url' => 'require|url|max:255',
|
|
'cid' => 'require|integer|gt:0',
|
|
'keywords' => 'max:255',
|
|
'description' => 'max:255',
|
|
'sort' => 'integer',
|
|
'status' => 'in:0,1,2',
|
|
'is_hot' => 'in:0,1',
|
|
'is_recommend' => 'in:0,1',
|
|
];
|
|
|
|
protected $message = [
|
|
'title.require' => '网站名称不能为空',
|
|
'title.max' => '网站名称不能超过 100 个字符',
|
|
'url.require' => '网址不能为空',
|
|
'url.url' => '网址格式不正确(需以 http:// 或 https:// 开头)',
|
|
'url.max' => '网址不能超过 255 个字符',
|
|
'cid.require' => '请选择所属分类',
|
|
'cid.integer' => '分类必须是数字',
|
|
'cid.gt' => '请选择有效的分类',
|
|
'keywords.max' => '关键词不能超过 255 个字符',
|
|
'description.max' => '描述不能超过 255 个字符',
|
|
'sort.integer' => '排序必须是数字',
|
|
'status.in' => '状态值不合法',
|
|
'is_hot.in' => '热门值不合法',
|
|
'is_recommend.in' => '推荐值不合法',
|
|
];
|
|
}
|