广告修改

This commit is contained in:
谢宇宁
2026-10-28 17:07:32 +07:00
parent d5d28c92ce
commit 654257a2d2
45 changed files with 363 additions and 576 deletions
+3 -37
View File
@@ -1,5 +1,5 @@
import { pickVideoCardTags } from "@/components/common/card-tags";
import { genres, regions, sorts, type Genre, type Region, type ShortDramaItem, type Sort } from "@/components/short-drama/data";
import { sorts, type ShortDramaItem, type Sort } from "@/components/short-drama/data";
import { formatHeat } from "@/components/ranking/data";
import type { VideoCategoryListItem, VideoListItem, VideoListResp } from "@/lib/api/types";
@@ -13,16 +13,8 @@ export function videoSortType(sort: VideoSort): 1 | 2 {
}
export function mapVideoListItem(item: VideoListItem): ShortDramaItem | null {
if (item.type === 2) {
return {
kind: "ad",
id: `ad-${item.advertiseId || item.id || item.link || "unknown"}`,
title: (item.title || "").trim() || "广告",
subtitle: "",
cover: (item.coverImg || "").trim(),
href: (item.link || "").trim() || undefined,
};
}
// 信息流广告(type=2)不展示:网页只保留后台 5 个站点广告位
if (item.type === 2) return null;
if (!item.id) return null;
const slug = (item.slug || "").trim();
@@ -77,29 +69,3 @@ export function buildVideoList(
};
}
/** @deprecated 本地 mock,供「更多」等未接接口页面临时使用 */
const adSlots = new Set([5, 11, 17, 24, 25]);
export function getVideos(genre: Genre, sort: Sort, page: number, region: Region = "全部"): ShortDramaItem[] {
const seed = `${genres.indexOf(genre)}-${sorts.indexOf(sort)}-${regions.indexOf(region)}-${page}`;
return Array.from({ length: VIDEO_PAGE_SIZE }, (_, index): ShortDramaItem => {
const id = `video-${seed}-${index}`;
const cover = "";
if (adSlots.has(index)) {
return { kind: "ad", id, title: "广告文案", subtitle: "我是副标题", cover };
}
return {
kind: "drama",
id,
title: "有恩必报",
subtitle: "权谋交锋爱意藏在局中",
tags: [{ name: genre === "全部" ? "标签" : genre }],
heat: "25.8万 热度",
episodes: "30集",
badge: "original",
cover,
};
});
}