實作個人收藏、個人活動紀錄
This commit is contained in:
@@ -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
|
||||
},
|
||||
|
Reference in New Issue
Block a user