优化外部上传和备注

This commit is contained in:
yml2213
2026-07-23 17:06:06 +08:00
parent c5f14ff8fd
commit 5668eb745f
8 changed files with 97 additions and 14 deletions
@@ -227,6 +227,7 @@ func externalAccountToCreateRequest(uploaderName string, uploadTime int64, item
staminaLevel := levelText(item.DailyConsumption.Stamina)
loadLevel := levelText(item.DailyConsumption.Weight)
skins := cleanStrings(item.Inventory.Skins)
remark := strings.TrimSpace(item.Remark)
assetSummary := map[string]any{
"face_owner": "",
"secret_kd": item.SecretKD,
@@ -241,7 +242,7 @@ func externalAccountToCreateRequest(uploaderName string, uploadTime int64, item
"online_time_text": strings.TrimSpace(item.OwnerOnlineTime),
"ban_record": normalizeBanRecord(item.BanRecord),
"common_regions": commonRegions(item.CommonRegion),
"remark": "开放接口自动上传,等待后台审核。",
"remark": remark,
"import_meta": map[string]any{
"uploader_name": uploaderName,
"client_upload_time": uploadTime,
@@ -262,7 +263,7 @@ func externalAccountToCreateRequest(uploaderName string, uploadTime int64, item
}
return CreateRequest{
Title: externalUploadTitle(item, insurance, hafCoinM),
Description: "开放接口自动上传,等待后台审核。",
Description: remark,
ServerRegion: serverRegionFromLoginMethod(item.LoginMethod),
LoginPlatform: strings.TrimSpace(item.LoginMethod),
RankLevel: strings.TrimSpace(item.Rank),
@@ -337,32 +338,71 @@ func externalResources(inventory ExternalUploadInventory) []any {
return resources
}
// 与 systemconfig 默认 publish_options 皮肤分组保持一致,避免详情页出现英文分组名。
var externalSkinCatalog = []struct {
key string
names []string
}{
{"melee", []string{"坠星者", "暗星", "龙牙", "信条", "怜悯", "赤枭", "影锋", "黑海", "北极星", "电锯惊魂", "处刑者"}},
{"operatorGold", []string{
"露娜-古墓丽影联动", "蛊-不羁人生", "红狼-电锯惊魂", "露娜-金牌射手",
"牧羊人-街头之星", "蜂医-危险物质", "蜂医-送葬人", "无名-夜鹰",
"威龙-壮志凌云", "威龙-蛟龙特战队", "威龙-铁面判官", "威龙-吴彦祖",
}},
{"operatorRed", []string{"凌霄成卫", "蚀金玫瑰", "水墨云图", "午夜邮差", "天际线", "维什戴尔"}},
{"weapon", []string{
"M7棱镜攻势S2", "腾龙气象感应", "MP7电玩高手S2", "M250电玩高手S2",
"AS Val悬赏令", "K416命运", "M4A1棱镜攻势", "SCAR-H电玩高手",
"QBZ95王牌之剑", "AUG气象感应", "Vector美杜莎", "KC17-造物纪元",
}},
}
func externalSkinGroups(skins []string) map[string][]string {
groups := map[string][]string{
"melee": {},
"imported": {},
}
groups := map[string][]string{}
for _, skin := range skins {
switch skin {
case "坠星者", "暗星", "龙牙", "信条", "怜悯", "赤枭", "影锋", "黑海", "北极星", "电锯惊魂", "处刑者":
groups["melee"] = append(groups["melee"], skin)
default:
groups["imported"] = append(groups["imported"], skin)
skin = strings.TrimSpace(skin)
if skin == "" {
continue
}
key := classifyExternalSkin(skin)
groups[key] = append(groups[key], skin)
}
return groups
}
func classifyExternalSkin(skin string) string {
// 先精确匹配,再做包含匹配,兼容“红狼-电锯惊魂 / 电锯惊魂”这类写法。
for _, group := range externalSkinCatalog {
for _, name := range group.names {
if skin == name {
return group.key
}
}
}
for _, group := range externalSkinCatalog {
for _, name := range group.names {
if strings.Contains(skin, name) || strings.Contains(name, skin) {
return group.key
}
}
}
return "other"
}
func normalizeBanRecord(value string) string {
value = strings.TrimSpace(value)
switch value {
case "", "无", "无封禁", "无封禁记录":
case "", "无", "无封禁", "无封禁记录", "否", "没有":
return "无封禁记录"
case "有", "是", "有封禁", "有封禁记录":
return "有封禁记录"
default:
return value
// 兼容历史详情文案:非空即视为有封禁
return "有封禁记录"
}
}
func commonRegions(value string) []string {
return cleanStrings(strings.Split(value, ","))
}