forked from imabutahersiddik/CodeStore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeveloper_dashboard.php
More file actions
44 lines (41 loc) · 1.19 KB
/
developer_dashboard.php
File metadata and controls
44 lines (41 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
class DeveloperDashboard {
private $pdo;
private $userId;
public function __construct($pdo, $userId) {
$this->pdo = $pdo;
$this->userId = $userId;
}
public function getAppStats() {
$stmt = $this->pdo->prepare("
SELECT
a.id,
a.app_name,
a.views_count,
a.downloads_count,
a.total_rating,
COUNT(DISTINCT ar.id) as review_count,
(SELECT COUNT(*)
FROM app_downloads
WHERE app_id = a.id
AND download_date >= DATE_SUB(NOW(), INTERVAL 30 DAY)
) as monthly_downloads
FROM apps a
LEFT JOIN app_ratings ar ON a.id = ar.app_id
WHERE a.user_id = ?
GROUP BY a.id
ORDER BY a.downloads_count DESC
");
$stmt->execute([$this->userId]);
return $stmt->fetchAll();
}
public function getRevenueStats() {
// Implement if you have a monetization system
return [
'total_revenue' => 0,
'monthly_revenue' => 0,
'pending_payments' => 0
];
}
}
?>