6
This commit is contained in:
@@ -8,7 +8,7 @@ use Firebase\JWT\SignatureInvalidException;
|
||||
use Firebase\JWT\BeforeValidException;
|
||||
|
||||
|
||||
$INTERNAL_KEY = trim(file_get_contents('/home/intaleq-api/.internal_socket_key'));
|
||||
$INTERNAL_KEY = trim(file_get_contents(getenv('INTERNAL_SOCKET_KEY_PATH')));
|
||||
|
||||
|
||||
/**
|
||||
@@ -22,8 +22,8 @@ $INTERNAL_KEY = trim(file_get_contents('/home/intaleq-api/.internal_socket_key')
|
||||
|
||||
function sendToLocationServer($action, $data) {
|
||||
// رابط سيرفر اللوكيشن الداخلي أو العام
|
||||
$url = "http://location.intaleq.xyz:2021";
|
||||
$INTERNAL_KEY = trim(@file_get_contents('/home/intaleq-api/.internal_socket_key'));
|
||||
$url = getenv('LOCATION_SOCKET_URL');
|
||||
$INTERNAL_KEY = trim(file_get_contents(getenv('INTERNAL_SOCKET_KEY_PATH')));
|
||||
|
||||
$postData = [
|
||||
'action' => $action,
|
||||
@@ -43,8 +43,8 @@ function sendToLocationServer($action, $data) {
|
||||
|
||||
function findBestDrivers($con, $lat, $lng, $carType) {
|
||||
// 1. الاتصال بـ Redis لجلب الأقرب
|
||||
$locationServerUrl = "https://location.intaleq.xyz/api_get_nearby.php";
|
||||
$INTERNAL_KEY = trim(@file_get_contents('/home/intaleq-api/.internal_socket_key'));
|
||||
$locationServerUrl = getenv('LOCATION_API_URL');
|
||||
$INTERNAL_KEY = trim(file_get_contents(getenv('INTERNAL_SOCKET_KEY_PATH')));
|
||||
|
||||
$postData = ['lat' => $lat, 'lng' => $lng, 'radius' => 5, 'limit' => 100];
|
||||
|
||||
@@ -158,7 +158,7 @@ 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('/home/intaleq-api/.internal_socket_key'));
|
||||
$INTERNAL_KEY = trim(file_get_contents(getenv('INTERNAL_SOCKET_KEY_PATH')));
|
||||
|
||||
$postData = [
|
||||
'action' => 'ride_taken_event', // هذا الأكشن الجديد في السوكيت
|
||||
@@ -181,7 +181,7 @@ function notifyDriversOnLocationServer($drivers_ids_array, $payload, $rideId = n
|
||||
// رابط سيرفر اللوكيشن الخارجي
|
||||
$url = getenv('LOCATION_SOCKET_URL');
|
||||
if (!$url) throw new RuntimeException('LOCATION_SOCKET_URL not configured');
|
||||
$INTERNAL_KEY = trim(@file_get_contents('/home/intaleq-api/.internal_socket_key'));
|
||||
$INTERNAL_KEY = trim(file_get_contents(getenv('INTERNAL_SOCKET_KEY_PATH')));
|
||||
|
||||
$postData = [
|
||||
'action' => 'dispatch_order', // اسم الحدث المتفق عليه في socket_server.php هناك
|
||||
@@ -221,7 +221,7 @@ function notifyPassengerOnRideServer($passenger_id, $payload) {
|
||||
error_log("[FATAL] PASSENGER_SOCKET_URL not configured");
|
||||
throw new RuntimeException('PASSENGER_SOCKET_URL not configured');
|
||||
}
|
||||
$INTERNAL_KEY = trim(@file_get_contents('/home/intaleq-api/.internal_socket_key'));
|
||||
$INTERNAL_KEY = trim(file_get_contents(getenv('INTERNAL_SOCKET_KEY_PATH')));
|
||||
|
||||
$postData = [
|
||||
'action' => 'update_ride_status',
|
||||
@@ -262,7 +262,7 @@ function dispatchRideToDrivers($driversData, $rideId, $payloadTemplate, $startNa
|
||||
$socketUrl = getenv('LOCATION_SOCKET_URL');
|
||||
if (!$socketUrl) throw new RuntimeException('LOCATION_SOCKET_URL not configured');
|
||||
|
||||
$internalKeyPath = '/home/intaleq-api/.internal_socket_key';
|
||||
$internalKeyPath = getenv('INTERNAL_SOCKET_KEY_PATH');
|
||||
$internalKey = file_exists($internalKeyPath) ? trim(file_get_contents($internalKeyPath)) : '';
|
||||
|
||||
foreach ($driversData as $driver) {
|
||||
|
||||
Reference in New Issue
Block a user