fix: hot trend, thread-detail
Change-Id: Id75946e6778134a4c1703508603b27cea23013d8
diff --git a/src/app/resource/hot-resource/page.tsx b/src/app/resource/hot-resource/page.tsx
index 3204d6a..4990638 100644
--- a/src/app/resource/hot-resource/page.tsx
+++ b/src/app/resource/hot-resource/page.tsx
@@ -41,18 +41,17 @@
resourceSummary: string;
lastUpdateTime: string;
hot: number;
- gamePlayList: { gameplayName: string }[];
+ gameplayList: string[];
}
interface HotEntry {
hot: number;
}
interface HotInfo {
- resourceId: number;
- resourceName: string;
- hotList: HotEntry[];
+ classify: string;
+ hotInfoList: HotEntry[];
}
interface HotInfoResponse {
- hotInfoList: HotInfo[];
+ records: HotInfo[];
}
interface HotResourceList {
total: number;
@@ -109,8 +108,9 @@
const fetchHotInfo = async () => {
try {
- const response = await axios.get<HotInfoResponse>(process.env.PUBLIC_URL + `/resource/hot-info`);
- const hotInfoList = response.data.hotInfoList;
+ const response = await axios.get<HotInfoResponse>(process.env.PUBLIC_URL + `/resource/hot-trend`);
+ console.log(response.data.records)
+ const records = response.data.records;
// 获取最近七天的日期标签(格式:MM-DD)
const labels = Array.from({ length: 7 }, (_, i) => {
@@ -119,9 +119,9 @@
return `${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`;
});
- const datasets = hotInfoList.map((info, idx) => ({
- label: info.resourceName,
- data: info.hotList.map(h => h.hot),
+ const datasets = records.map((info, idx) => ({
+ label: info.classify,
+ data: info.hotInfoList.map(h => h.hot),
fill: false,
tension: 0.4,
borderColor: generateColor(idx),
@@ -243,8 +243,8 @@
<div className="resource-content">
<h3>{hotResource.resourceName}</h3>
<div className="tags">
- {hotResource.gamePlayList.map((tag, index) => (
- <Tag key={index} value={tag.gameplayName} />
+ {hotResource.gameplayList.map((tag, index) => (
+ <Tag key={index} value={tag} />
))}
</div>
</div>