移除多余的属性,增加标签

为系统设置页准备
This commit is contained in:
Chenx221 2024-03-30 13:45:00 +08:00
parent 9e16b46d19
commit 5b2c2564c9
Signed by: chenx221
GPG Key ID: D7A9EC07024C3021

View File

@ -24,18 +24,35 @@ class SiteConfig extends Model
public string $hcaptchaSecret; // hCaptcha Secret
public string $turnstileSiteKey; // Turnstile Site Key
public string $turnstileSecret; // Turnstile Secret
public string $cookieValidationKey; // Cookie Validation Key
public bool $enableIpinfo; // 启用 ipinfo.io 查询
public string $ipinfoToken; // IPinfo Token
public function rules(): array
{
return [
[['siteTitle', 'siteUrl', 'domain', 'verifyProvider', 'recaptchaSiteKey', 'recaptchaSecret', 'hcaptchaSiteKey', 'hcaptchaSecret', 'turnstileSiteKey', 'turnstileSecret', 'cookieValidationKey', 'ipinfoToken'], 'string'],
[['siteTitle', 'siteUrl', 'domain', 'verifyProvider', 'recaptchaSiteKey', 'recaptchaSecret', 'hcaptchaSiteKey', 'hcaptchaSecret', 'turnstileSiteKey', 'turnstileSecret', 'ipinfoToken'], 'string'],
[['registrationEnabled', 'enableIpinfo'], 'boolean'],
];
}
public function attributeLabels(): array
{
return [
'siteTitle' => '网站标题',
'registrationEnabled' => '允许注册',
'domain' => '站点域名',
'verifyProvider' => '验证码服务',
'recaptchaSiteKey' => 'reCAPTCHA Site Key',
'recaptchaSecret' => 'reCAPTCHA Secret',
'hcaptchaSiteKey' => 'hCaptcha Site Key',
'hcaptchaSecret' => 'hCaptcha Secret',
'turnstileSiteKey' => 'Turnstile Site Key',
'turnstileSecret' => 'Turnstile Secret',
'enableIpinfo' => '启用 ipinfo.io 查询',
'ipinfoToken' => 'IPinfo Token',
];
}
/**
* 读取配置信息
* @return bool
@ -82,7 +99,6 @@ class SiteConfig extends Model
$env['HCAPTCHA_SECRET'] = $this->hcaptchaSecret;
$env['TURNSTILE_SITE_KEY'] = $this->turnstileSiteKey;
$env['TURNSTILE_SECRET'] = $this->turnstileSecret;
$env['COOKIE_VALIDATION_KEY'] = $this->cookieValidationKey;
$env['ENABLE_IPINFO'] = $this->enableIpinfo ? 'true' : 'false';
$env['IPINFO_TOKEN'] = $this->ipinfoToken;
$data = array_map(function ($key, $value) {