實作個人收藏、個人活動紀錄

This commit is contained in:
2025-09-11 17:40:07 +08:00
parent bc2104d374
commit 9c5dceb001
29 changed files with 3781 additions and 601 deletions

View File

@@ -6,6 +6,11 @@ const appService = new AppService()
export async function GET(request: NextRequest, { params }: { params: { id: string } }) {
try {
const { id: appId } = await params
const { searchParams } = new URL(request.url)
// 獲取日期範圍參數
const startDate = searchParams.get('startDate')
const endDate = searchParams.get('endDate')
// 獲取應用基本統計
const app = await appService.getAppById(appId)
@@ -19,8 +24,11 @@ export async function GET(request: NextRequest, { params }: { params: { id: stri
// 獲取評分統計
const ratingStats = await appService.getAppRatingStats(appId)
// 獲取使用趨勢數據
const usageStats = await appService.getAppUsageStats(appId)
// 獲取使用趨勢數據(支援日期範圍)
const usageStats = await appService.getAppUsageStats(appId, startDate || undefined, endDate || undefined)
// 獲取收藏數量
const favoritesCount = await appService.getAppFavoritesCount(appId)
return NextResponse.json({
success: true,
@@ -28,6 +36,7 @@ export async function GET(request: NextRequest, { params }: { params: { id: stri
basic: {
views: app.views_count || 0,
likes: app.likes_count || 0,
favorites: favoritesCount,
rating: ratingStats.averageRating || 0,
reviewCount: ratingStats.totalRatings || 0
},