fix: SiteType 改为引擎类型,与 mediabot 对齐

nexusphp/mtorrent/mteam/pttime/gazelle/unit3d/jsonapi/unknown
DB默认值 private → unknown
This commit is contained in:
mediabot-pt
2026-06-29 18:20:43 +08:00
parent f247cc15fe
commit c7a3f653c1
3 changed files with 14 additions and 14 deletions

View File

@@ -4,12 +4,17 @@ import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
/**
* 站点类型枚举
* 站点引擎类型(与 mediabot 保持一致)。
*/
public enum SiteType {
PRIVATE("private", "私有站点"),
PUBLIC("public", "公开站点"),
SEMI_PUBLIC("semi_public", "半公开站点");
NEXUSPHP("nexusphp", "NexusPHP"),
MTORRENT("mtorrent", "MTorrent"),
MTEAM("mteam", "M-Team API"),
PTTIME("pttime", "PTTime"),
GAZELLE("gazelle", "Gazelle"),
UNIT3D("unit3d", "UNIT3D"),
JSONAPI("jsonapi", "JSON API"),
UNKNOWN("unknown", "未知");
@EnumValue
@JsonValue
@@ -22,13 +27,8 @@ public enum SiteType {
this.label = label;
}
public String getValue() {
return value;
}
public String getLabel() {
return label;
}
public String getValue() { return value; }
public String getLabel() { return label; }
public static SiteType fromValue(String value) {
for (SiteType type : values()) {
@@ -36,6 +36,6 @@ public enum SiteType {
return type;
}
}
return PRIVATE;
return UNKNOWN;
}
}

View File

@@ -75,7 +75,7 @@ public class SiteServiceImpl implements SiteService {
site.setDescription(description);
site.setBaseUrl(baseUrl);
site.setIconUrl(iconUrl);
site.setSiteType(siteType != null ? com.par.core.enums.SiteType.fromValue(siteType) : com.par.core.enums.SiteType.PRIVATE);
site.setSiteType(siteType != null ? com.par.core.enums.SiteType.fromValue(siteType) : com.par.core.enums.SiteType.UNKNOWN);
site.setSchemaVersion("1.0.0");
site.setStatus(SiteStatus.ACTIVE);
site.setSubmitterId(submitterId);

View File

@@ -30,7 +30,7 @@ CREATE TABLE sites (
description TEXT COMMENT '站点描述',
base_url VARCHAR(500) COMMENT '站点基础URL',
icon_url VARCHAR(500) COMMENT '站点图标URL',
site_type VARCHAR(50) NOT NULL DEFAULT 'private' COMMENT '站点类型: private/public/xxx',
site_type VARCHAR(50) NOT NULL DEFAULT 'unknown' COMMENT '站点引擎类型: nexusphp/mtorrent/mteam/...',
schema_version VARCHAR(20) NOT NULL DEFAULT '1.0.0' COMMENT '当前生效的schema版本',
current_config_id BIGINT UNSIGNED COMMENT '当前生效的配置版本ID(site_configs.id)',
status VARCHAR(20) NOT NULL DEFAULT 'active' COMMENT '站点状态: active/pending/deprecated',