Update: 2026-07-04 18:43:56

This commit is contained in:
Hamza-Ayed
2026-07-04 18:43:57 +03:00
parent 3412f1b753
commit 3e0b4cbf64
65 changed files with 2260 additions and 118 deletions
+9 -1
View File
@@ -199,13 +199,21 @@ try {
}
// ═══════════════════════════════════════════════════════════
// STEP F — تنظيف السوق (أبلغ location server إن الرحلة محجوزة)
// STEP F — تنظيف السوق + Cache ride state (أبلغ location server)
// ═══════════════════════════════════════════════════════════
sendToLocationServer('ride_taken_event', [
'ride_id' => $rideId,
'taken_by_driver_id' => $driverId,
]);
// 🆕 Cache ride state in Redis
sendToLocationServer('update_ride_state', [
'ride_id' => $rideId,
'status' => $status,
'driver_id' => $driverId,
'passenger_id' => $passengerIdValue ?? '',
]);
error_log("[accept_ride] SUCCESS. RideID=$rideId accepted by DriverID=$driverId");
// ═══════════════════════════════════════════════════════════
+8
View File
@@ -67,6 +67,14 @@ try {
}
}
// 🆕 Cache ride state in Redis
sendToLocationServer('update_ride_state', [
'ride_id' => $rideId,
'status' => 'arrived',
'driver_id' => $driverId,
'passenger_id' => $passenger_id ?? '',
]);
jsonSuccess(null, "Arrival notified successfully");
} catch (Exception $e) {
@@ -212,6 +212,14 @@ try {
$con->commit();
// 🆕 Cache ride state in Redis
sendToLocationServer('update_ride_state', [
'ride_id' => $rideId,
'status' => 'cancelled_by_driver',
'driver_id' => $driverId,
'passenger_id' => $passenger_id ?? '',
]);
// 5. الرد للفلاتر
echo json_encode([
"status" => "success",
@@ -146,6 +146,14 @@ try {
}
}
// 🆕 Cache ride state in Redis
sendToLocationServer('update_ride_state', [
'ride_id' => $rideId,
'status' => 'cancelled_by_passenger',
'driver_id' => $driverId ?? '',
'passenger_id' => $ride['passenger_id'] ?? '',
]);
jsonSuccess(null, "Ride cancelled successfully");
} catch (PDOException $e) {
+9
View File
@@ -117,6 +117,15 @@ try {
}
$con->commit();
// 🆕 Cache ride state in Redis
sendToLocationServer('update_ride_state', [
'ride_id' => $ride_id,
'status' => 'started',
'driver_id' => $driver_id,
'passenger_id' => $passenger_id ?? '',
]);
jsonSuccess(null, "Ride started successfully");
} catch (PDOException $e) {