Merge "fix: hot trend, thread-detail" into main
diff --git "a/src/app/community/community-detail/\133communityId\135/page.tsx" "b/src/app/community/community-detail/\133communityId\135/page.tsx"
index 850c54e..962cc0f 100644
--- "a/src/app/community/community-detail/\133communityId\135/page.tsx"
+++ "b/src/app/community/community-detail/\133communityId\135/page.tsx"
@@ -111,7 +111,7 @@
const option = selectedOption.name // 添加排序参数
const response = await axios.get<ThreadList>(
process.env.PUBLIC_URL + `/community/threads`, {
- params: { communityId, pageNumber, rows, option, searchValue }
+ params: { userId: 22301145, communityId, pageNumber, rows, option, searchValue }
}
);
console.log('获取帖子列表:', response.data.records);
diff --git "a/src/app/community/thread-detail/\133threadId\135/page.tsx" "b/src/app/community/thread-detail/\133threadId\135/page.tsx"
index 89ae1e8..f998f64 100644
--- "a/src/app/community/thread-detail/\133threadId\135/page.tsx"
+++ "b/src/app/community/thread-detail/\133threadId\135/page.tsx"
@@ -101,7 +101,12 @@
const fetchThreadInfo = async () => {
try {
- const { data } = await axios.get(process.env.PUBLIC_URL + `/thread?threadId=${threadId}`);
+ const { data } = await axios.get(process.env.PUBLIC_URL + `/thread`, {
+ params: {
+ threadId,
+ userId: 22301145
+ }
+ });
setThreadInfo(data);
setTotalComments(data.commentNumber);
} catch (err) {
@@ -110,6 +115,7 @@
}
};
+
// 获取发帖人
useEffect(() => {
if (!threadInfo) return;
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>