20
This commit is contained in:
@@ -8,7 +8,7 @@ use Firebase\JWT\SignatureInvalidException;
|
|||||||
use Firebase\JWT\BeforeValidException;
|
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) ---
|
// --- دالة مساعدة لمخاطبة سيرفر السائقين (Location Socket) ---
|
||||||
function notifyDriversRideTaken($rideId, $winnerDriverId) {
|
function notifyDriversRideTaken($rideId, $winnerDriverId) {
|
||||||
// رابط سيرفر السائقين الداخلي (نفس البورت المستخدم في driver_socket.php)
|
// رابط سيرفر السائقين الداخلي (نفس البورت المستخدم في driver_socket.php)
|
||||||
$url = getenv('LOCATION_SOCKET_URL');
|
$url = "http://188.68.36.205:2021";
|
||||||
if (!$url) throw new RuntimeException('LOCATION_SOCKET_URL not configured');
|
$INTERNAL_KEY = trim((string)@file_get_contents('/home/intaleq-api/.internal_socket_key'));
|
||||||
$INTERNAL_KEY = trim(file_get_contents(getenv('INTERNAL_SOCKET_KEY_PATH')));
|
|
||||||
|
|
||||||
$postData = [
|
$postData = [
|
||||||
'action' => 'ride_taken_event', // هذا الأكشن الجديد في السوكيت
|
'action' => 'ride_taken_event', // هذا الأكشن الجديد في السوكيت
|
||||||
@@ -181,9 +180,8 @@ function notifyDriversRideTaken($rideId, $winnerDriverId) {
|
|||||||
}
|
}
|
||||||
function notifyDriversOnLocationServer($drivers_ids_array, $payload, $rideId = null) {
|
function notifyDriversOnLocationServer($drivers_ids_array, $payload, $rideId = null) {
|
||||||
// رابط سيرفر اللوكيشن الخارجي
|
// رابط سيرفر اللوكيشن الخارجي
|
||||||
$url = getenv('LOCATION_SOCKET_URL');
|
$url = "http://188.68.36.205:2021";
|
||||||
if (!$url) throw new RuntimeException('LOCATION_SOCKET_URL not configured');
|
$INTERNAL_KEY = trim((string)@file_get_contents('/home/intaleq-api/.internal_socket_key'));
|
||||||
$INTERNAL_KEY = trim(file_get_contents(getenv('INTERNAL_SOCKET_KEY_PATH')));
|
|
||||||
|
|
||||||
$postData = [
|
$postData = [
|
||||||
'action' => 'dispatch_order', // اسم الحدث المتفق عليه في socket_server.php هناك
|
'action' => 'dispatch_order', // اسم الحدث المتفق عليه في socket_server.php هناك
|
||||||
@@ -217,13 +215,13 @@ function notifyDriversOnLocationServer($drivers_ids_array, $payload, $rideId = n
|
|||||||
* تخاطب السوكيت الموجود محلياً على نفس السيرفر
|
* تخاطب السوكيت الموجود محلياً على نفس السيرفر
|
||||||
*/
|
*/
|
||||||
function notifyPassengerOnRideServer($passenger_id, $payload) {
|
function notifyPassengerOnRideServer($passenger_id, $payload) {
|
||||||
// الرابط المحلي لسيرفر سوكيت الركاب
|
// الرابط لسيرفر سوكيت الركاب — IP مباشر لتجاوز مشاكل الجدار الناري والدومين
|
||||||
$url = getenv('PASSENGER_SOCKET_URL');
|
$url = "http://188.68.36.205:3031";
|
||||||
if (!$url) {
|
$INTERNAL_KEY = trim((string)@file_get_contents('/home/intaleq-api/.internal_socket_key'));
|
||||||
error_log("[FATAL] PASSENGER_SOCKET_URL not configured");
|
|
||||||
throw new RuntimeException('PASSENGER_SOCKET_URL not configured');
|
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 = [
|
$postData = [
|
||||||
'action' => 'update_ride_status',
|
'action' => 'update_ride_status',
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ try {
|
|||||||
$audience = filterRequest('aud');
|
$audience = filterRequest('aud');
|
||||||
$fingerPrint = filterRequest('fingerPrint') ?? filterRequest('fingerprint');
|
$fingerPrint = filterRequest('fingerPrint') ?? filterRequest('fingerprint');
|
||||||
|
|
||||||
$allowed1 = getenv('allowed1');
|
$allowed1 = getenv('allowedWallet1');
|
||||||
$allowed2 = getenv('allowed2');
|
$allowed2 = getenv('allowedWallet2');
|
||||||
$allowedAudiences = array_values(array_filter([$allowed1, $allowed2]));
|
$allowedAudiences = array_values(array_filter([$allowed1, $allowed2]));
|
||||||
$passwordnewpassenger = getenv('passwordnewpassenger');
|
$passwordnewpassenger = getenv('passwordnewpassenger');
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,8 @@ try {
|
|||||||
if (!empty($passengerToken)) {
|
if (!empty($passengerToken)) {
|
||||||
$fcmData = [
|
$fcmData = [
|
||||||
'category' => 'Arrive Ride', // نفس الاسم القديم لضمان عمل التطبيق
|
'category' => 'Arrive Ride', // نفس الاسم القديم لضمان عمل التطبيق
|
||||||
'ride_id' => (string)$rideId
|
'ride_id' => (string)$rideId,
|
||||||
|
'status' => 'arrived'
|
||||||
];
|
];
|
||||||
|
|
||||||
// 🔥 استخدام sendFCM_Internal كرسالة صامتة
|
// 🔥 استخدام sendFCM_Internal كرسالة صامتة
|
||||||
|
|||||||
@@ -75,7 +75,9 @@ try {
|
|||||||
// ب) إرسال FCM (Internal)
|
// ب) إرسال FCM (Internal)
|
||||||
if (!empty($passengerToken)) {
|
if (!empty($passengerToken)) {
|
||||||
$fcmData = [
|
$fcmData = [
|
||||||
'ride_id' => (string)$ride_id
|
'category' => 'Trip is Begin',
|
||||||
|
'ride_id' => (string)$ride_id,
|
||||||
|
'status' => 'started'
|
||||||
];
|
];
|
||||||
|
|
||||||
// 🔥 استخدام sendFCM_Internal كرسالة صامتة
|
// 🔥 استخدام sendFCM_Internal كرسالة صامتة
|
||||||
|
|||||||
Reference in New Issue
Block a user