Update: 2026-07-02 05:27:04
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user