diff --git a/backend/functions.php b/backend/functions.php index 33699564..cf028e76 100644 --- a/backend/functions.php +++ b/backend/functions.php @@ -37,6 +37,11 @@ function getAllowedSocketUrls(): array { } // القيم الافتراضية لو لم تكن موجودة في .env return [ + 'http://nginx', + 'http://socket_driver', + 'http://socket_passenger', + 'http://127.0.0.1', + 'http://localhost', 'http://location.intaleq.xyz:2021', 'http://location.intaleq.xyz:3031', 'https://location.intaleq.xyz', @@ -311,7 +316,7 @@ function notifyDriversOnLocationServer($drivers_ids_array, $payload, $rideId = n * تخاطب السوكيت الموجود محلياً على نفس السيرفر */ function notifyPassengerOnRideServer($passenger_id, $payload) { - $url = getenv('RIDE_SOCKET_URL') ?: 'http://nginx/loction_server/passenger_socket.php'; + $url = getenv('PASSENGER_SOCKET_INTERNAL_URL') ?: (getenv('RIDE_SOCKET_URL') ?: 'http://socket_passenger:3031'); if (!isAllowedSocketUrl($url)) return null; $INTERNAL_KEY = function_exists('getInternalSocketKey') ? getInternalSocketKey() : ''; diff --git a/backend/ride/rides/getRideStatusFromStartApp.php b/backend/ride/rides/getRideStatusFromStartApp.php index 0fe6c5b6..cf6b1243 100644 --- a/backend/ride/rides/getRideStatusFromStartApp.php +++ b/backend/ride/rides/getRideStatusFromStartApp.php @@ -21,10 +21,11 @@ try { FROM ride WHERE passenger_id = ? AND ( - status IN ('Apply', 'Applied', 'accepted', 'arrived', 'Arrived', 'Begin') AND created_at >= NOW() - INTERVAL 1 HOUR - OR (status = 'Finished' AND created_at >= NOW() - INTERVAL 1 HOUR) + status IN ('waiting', 'wait', 'Apply', 'Applied', 'accepted', 'arrived', 'Arrived', 'Begin') + AND TIMESTAMP(date, time) >= NOW() - INTERVAL 1 HOUR + OR (status = 'Finished' AND updated_at >= NOW() - INTERVAL 1 HOUR) ) - ORDER BY created_at DESC + ORDER BY TIMESTAMP(date, time) DESC LIMIT 1 ");