Files
Siro/backend/api/ride/get_hotzones.php
T

31 lines
1.0 KiB
PHP

<?php
/**
* get_hotzones.php
* ───────────────
* واجهة فائقة السرعة (Ultra-Fast API) مخصصة لتطبيق السائق (Flutter).
* تقرأ المناطق الساخنة (Hot Zones) التي حددها الذكاء الاصطناعي من الـ Redis مباشرة.
* زمن الاستجابة: O(1).
*/
header('Content-Type: application/json; charset=utf-8');
require_once __DIR__ . '/../../connect.php';
$countryCode = strtoupper(filterRequest('country_code') ?? 'JO');
try {
$redis = getRedisConnection();
$hotZonesJson = $redis->get('siro:cache:ai:hotzones');
} catch (Exception $e) {
echo json_encode(["status" => "error", "message" => "Redis connection failed"]);
exit;
}
if (!$hotZonesJson) {
echo json_encode(["status" => "success", "data" => [], "message" => "No hot zones available"]);
exit;
}
// الـ JSON القادم من Redis تم تصميمه بالفعل بالشكل النهائي المطلوب للتطبيق
echo $hotZonesJson;
?>