integraçao site

This commit is contained in:
HalbeBruno
2025-12-17 12:33:42 -03:00
parent fca10b13c1
commit 72b7d8ccd7
572 changed files with 1646 additions and 27 deletions

View File

@@ -0,0 +1,38 @@
<?php
namespace App\Controllers;
use App\Models\Order;
use App\Models\Domain;
use App\Models\Setting;
use App\Utils\View;
class IntegrationController
{
public function stats()
{
$orderModel = new Order();
$domainModel = new Domain();
$settingModel = new Setting();
// Orders metrics
$totalOrders = $orderModel->countAll();
$recentOrders = $orderModel->countRecent(7); // Last 7 days
// Domain metrics
$blockedDomains = $domainModel->countBlocked();
// Last Update - Try specific key first, fallback to now if not set yet
$lastUpdate = $settingModel->get('last_rpz_update');
if (!$lastUpdate) {
$lastUpdate = date('Y-m-d H:i:s');
}
View::json([
'orders_total' => $totalOrders,
'orders_recent' => $recentOrders,
'domains_blocked' => $blockedDomains,
'last_update' => $lastUpdate
]);
}
}