删除福利应用

This commit is contained in:
谢宇宁
2026-10-28 16:20:38 +07:00
parent 1a4718176d
commit 4e98b85fd8
18 changed files with 17 additions and 1090 deletions
+4 -5
View File
@@ -39,8 +39,6 @@ func ResolveNavigationActiveKey(activeKey, requestPath string) string {
return "todayUpdate"
case strings.HasPrefix(path, "/category/"):
return "category"
case path == "/application" || strings.HasPrefix(path, "/application/"):
return "application"
case path == "/home-road" || strings.HasPrefix(path, "/home-road/"):
return "homeRoad"
case path == "/list" || strings.HasPrefix(path, "/detail/") || strings.HasPrefix(path, "/play/") || path == "/more" || strings.HasPrefix(path, "/more/") || path == "/search" || strings.HasPrefix(path, "/search/"):
@@ -91,7 +89,6 @@ func DefaultHeaderNav() []HeaderNavItemVM {
{Name: "回家的路", Href: "/home-road/", Key: "homeRoad"},
{Name: "今日更新", Href: "/today-update/", Key: "todayUpdate"},
{Name: "下载APP", Href: "javascript:;", Key: "downloadApp", IsDownload: true},
{Name: "福利应用", Href: "/application/", Key: "application"},
}
}
@@ -117,6 +114,10 @@ func BuildHeaderNav(info *AppTranslationInfo) []HeaderNavItemVM {
SeoInfo: normalizeNavigationSEO(cat.SeoInfo),
}
href, external, download := normalizeNavURL(cat.URLValue, name)
// 福利应用页已下线,后台残留的导航项不再展示
if !external && normalizeNavPath(href) == "/application" {
continue
}
item.Href = href
item.IsExternal = external
item.IsDownload = download
@@ -270,8 +271,6 @@ func navActiveKey(href, name string, download bool) string {
return "rank"
case "/today-update":
return "todayUpdate"
case "/application":
return "application"
case "/tag":
return "tagList"
case "/topic":
+10 -1
View File
@@ -13,7 +13,6 @@ func TestResolveNavigationActiveKey(t *testing.T) {
"/topic/editor-picks/page/2": "topic",
"/rank/2/page/3": "rank",
"/category/latest-video/": "category",
"/application": "application",
"/home-road": "homeRoad",
"/detail/example-playlet": "list",
"/play/example-playlet/chapter-1": "list",
@@ -81,3 +80,13 @@ func TestNormalizeNavURLKeepsConfiguredURL(t *testing.T) {
t.Fatalf("normalizeNavURL configured download URL = (%q, %v, %v)", href, external, download)
}
}
func TestBuildHeaderNavSkipsApplication(t *testing.T) {
items := BuildHeaderNav(&AppTranslationInfo{CategoryList: []TranslationCategory{
{Name: "排行榜", URLValue: "/rank/", CategoryType: 1},
{Name: "福利应用", URLValue: "/application/", CategoryType: 1},
}})
if len(items) != 1 || items[0].Href != "/rank/" {
t.Fatalf("BuildHeaderNav = %+v, want only /rank/", items)
}
}