初始版本

This commit is contained in:
root
2026-06-14 21:12:22 +08:00
commit 6a81742dc7
806 changed files with 179174 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
<?php
declare(strict_types=1);
namespace app\admin\validate;
use app\admin\model\Domain as DomainModel;
use think\Validate;
/**
* 域名验证器
*/
class Domain extends Validate
{
protected $rule = [
'domain' => 'require|checkDomain',
];
protected $message = [
'domain.require' => '请输入根域名',
];
protected $scene = [
'add' => ['domain'],
];
/**
* @param string $value
* @return bool|string
*/
protected function checkDomain($value)
{
$domain = DomainModel::normalizeDomain((string)$value);
if (!DomainModel::isValidRootDomain($domain)) {
return '请输入合法根域名,不要填写 www 或二级子域名,且不支持中国域名后缀';
}
return true;
}
}