Update: 2026-07-02 05:27:04

This commit is contained in:
Hamza-Ayed
2026-07-02 05:27:05 +03:00
parent d2ce4bdb16
commit 05d047d871
25 changed files with 1625 additions and 85 deletions
+25
View File
@@ -66,6 +66,31 @@ foreach ($keys as $key) {
}
}
// === MERGE AI HOT ZONES ===
// ندمج مناطق الذروة الخاصة بالمنافسين (التي استخرجها الذكاء الاصطناعي) لتظهر باللون الأحمر (High)
try {
$aiHotZonesJson = $redis->get('siro:cache:ai:hotzones');
if ($aiHotZonesJson) {
$aiZonesData = json_decode($aiHotZonesJson, true);
if (isset($aiZonesData['status']) && $aiZonesData['status'] == 'success' && isset($aiZonesData['data'])) {
foreach ($aiZonesData['data'] as $zone) {
// نضيفها للمصفوفة ليقوم تطبيق الفلاتر برسمها كمربعات حمراء تلقائياً
$heatmap_data[] = [
"lat" => (float)$zone['latitude'],
"lng" => (float)$zone['longitude'],
"count" => 99, // رقم كبير لإجبار التطبيق على تلوينها بالأحمر (High)
"intensity" => "high",
"is_ai_surge" => true,
"competitor" => $zone['top_competitor'] ?? '',
"price" => $zone['avg_price'] ?? 0
];
}
}
}
} catch (Exception $e) {
error_log("[heatmap_live.php] AI Hotzones merge error: " . $e->getMessage());
}
// Output the JSON array as expected by home_captain_controller.dart
header('Content-Type: application/json');
echo json_encode($heatmap_data);