feat: 页面配置key改为枚举下拉框+自动填method
This commit is contained in:
41
par-core/src/main/java/com/par/core/enums/PageKey.java
Normal file
41
par-core/src/main/java/com/par/core/enums/PageKey.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package com.par.core.enums;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
/**
|
||||
* 站点页面入口 key 枚举 — 统一命名,脚本据此分发解析逻辑
|
||||
*/
|
||||
public enum PageKey {
|
||||
SYNC("sync", "同步", "GET"),
|
||||
SIGN_IN("signIn", "签到", "POST"),
|
||||
SEARCH("search", "搜索", "GET"),
|
||||
DETAIL("detail", "资源详情", "GET"),
|
||||
DOWNLOAD("download", "下载", "GET"),
|
||||
USER("user", "用户信息", "GET"),
|
||||
HOME("home", "首页", "GET"),
|
||||
TORRENTS("torrents", "种子列表", "GET"),
|
||||
BONUS("bonus", "魔力值", "GET"),
|
||||
MESSAGES("messages", "消息", "GET");
|
||||
|
||||
private final String key;
|
||||
private final String label;
|
||||
private final String defaultMethod;
|
||||
|
||||
PageKey(String key, String label, String defaultMethod) {
|
||||
this.key = key;
|
||||
this.label = label;
|
||||
this.defaultMethod = defaultMethod;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getKey() { return key; }
|
||||
public String getLabel() { return label; }
|
||||
public String getDefaultMethod() { return defaultMethod; }
|
||||
|
||||
public static PageKey fromKey(String key) {
|
||||
for (var pk : values()) {
|
||||
if (pk.key.equalsIgnoreCase(key)) return pk;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user