Update: 2026-07-22 17:49:27
This commit is contained in:
@@ -32,7 +32,7 @@ try {
|
||||
// 2. طلب بيانات السائقين من سيرفر اللوكيشن (Redis API)
|
||||
// — يرجع cache hits لو موجودة، وإلا يرجع IDs فقط
|
||||
// ==========================================
|
||||
$locationServerUrl = getenv('LOCATION_API_URL') ?: 'http://nginx/loction_server/api_get_nearby.php';
|
||||
$locationServerUrl = getenv('LOCATION_API_URL') ?: 'https://jordan-siro.intaleqapp.com/loction_server/api_get_nearby.php';
|
||||
$keyPath = getenv('INTERNAL_SOCKET_KEY_PATH') ?: '/keys/.internal_socket_key';
|
||||
$INTERNAL_KEY = getenv('INTERNAL_SOCKET_KEY') ?: (file_exists($keyPath) ? trim((string)@file_get_contents($keyPath)) : (file_exists('/home/location/.internal_socket_key') ? trim((string)@file_get_contents('/home/location/.internal_socket_key')) : ''));
|
||||
|
||||
@@ -57,7 +57,7 @@ try {
|
||||
if ($httpCode == 200 && $response) {
|
||||
$json = json_decode($response, true);
|
||||
if (isset($json['status']) && $json['status'] === true) {
|
||||
$redisDrivers = $json['data'];
|
||||
$redisDrivers = $json['drivers'] ?? $json['data'] ?? [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,14 +73,17 @@ try {
|
||||
$serverNow = date('Y-m-d H:i:s');
|
||||
|
||||
foreach ($redisDrivers as $d) {
|
||||
$driverId = $d['driver_id'] ?? $d['id'] ?? null;
|
||||
if (!$driverId) continue;
|
||||
|
||||
if (!empty($d['cached']) && !empty($d['first_name'])) {
|
||||
// ✅ Cache hit — بيانات السائق كاملة من Redis, نستخدمها مباشرة
|
||||
$d['serverNow'] = $serverNow;
|
||||
$final_result[] = $d;
|
||||
} else {
|
||||
// ❌ Cache miss — نحتاج نجيب البيانات من MySQL
|
||||
$mysqlIds[] = $d['id'];
|
||||
$driversMap[$d['id']] = $d;
|
||||
$mysqlIds[] = $driverId;
|
||||
$driversMap[$driverId] = $d;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user