This commit is contained in:
Hamza-Ayed
2026-04-29 16:00:07 +03:00
parent c339e87aeb
commit 2266d28416
4 changed files with 18 additions and 17 deletions

View File

@@ -8,7 +8,7 @@ use Firebase\JWT\SignatureInvalidException;
use Firebase\JWT\BeforeValidException;
$INTERNAL_KEY = trim(file_get_contents(getenv('INTERNAL_SOCKET_KEY_PATH')));
$INTERNAL_KEY = trim((string)@file_get_contents('/home/intaleq-api/.internal_socket_key'));
/**
@@ -158,9 +158,8 @@ function findBestDrivers($con, $lat, $lng, $carType) {
// --- دالة مساعدة لمخاطبة سيرفر السائقين (Location Socket) ---
function notifyDriversRideTaken($rideId, $winnerDriverId) {
// رابط سيرفر السائقين الداخلي (نفس البورت المستخدم في driver_socket.php)
$url = getenv('LOCATION_SOCKET_URL');
if (!$url) throw new RuntimeException('LOCATION_SOCKET_URL not configured');
$INTERNAL_KEY = trim(file_get_contents(getenv('INTERNAL_SOCKET_KEY_PATH')));
$url = "http://188.68.36.205:2021";
$INTERNAL_KEY = trim((string)@file_get_contents('/home/intaleq-api/.internal_socket_key'));
$postData = [
'action' => 'ride_taken_event', // هذا الأكشن الجديد في السوكيت
@@ -181,9 +180,8 @@ function notifyDriversRideTaken($rideId, $winnerDriverId) {
}
function notifyDriversOnLocationServer($drivers_ids_array, $payload, $rideId = null) {
// رابط سيرفر اللوكيشن الخارجي
$url = getenv('LOCATION_SOCKET_URL');
if (!$url) throw new RuntimeException('LOCATION_SOCKET_URL not configured');
$INTERNAL_KEY = trim(file_get_contents(getenv('INTERNAL_SOCKET_KEY_PATH')));
$url = "http://188.68.36.205:2021";
$INTERNAL_KEY = trim((string)@file_get_contents('/home/intaleq-api/.internal_socket_key'));
$postData = [
'action' => 'dispatch_order', // اسم الحدث المتفق عليه في socket_server.php هناك
@@ -217,13 +215,13 @@ function notifyDriversOnLocationServer($drivers_ids_array, $payload, $rideId = n
* تخاطب السوكيت الموجود محلياً على نفس السيرفر
*/
function notifyPassengerOnRideServer($passenger_id, $payload) {
// الرابط المحلي لسيرفر سوكيت الركاب
$url = getenv('PASSENGER_SOCKET_URL');
if (!$url) {
error_log("[FATAL] PASSENGER_SOCKET_URL not configured");
throw new RuntimeException('PASSENGER_SOCKET_URL not configured');
// الرابط لسيرفر سوكيت الركاب — IP مباشر لتجاوز مشاكل الجدار الناري والدومين
$url = "http://188.68.36.205:3031";
$INTERNAL_KEY = trim((string)@file_get_contents('/home/intaleq-api/.internal_socket_key'));
if (empty($INTERNAL_KEY)) {
error_log("[SOCKET_CRITICAL] Internal key missing at /home/intaleq-api/.internal_socket_key");
}
$INTERNAL_KEY = trim(file_get_contents(getenv('INTERNAL_SOCKET_KEY_PATH')));
$postData = [
'action' => 'update_ride_status',