Update: 2026-06-21 02:07:00
This commit is contained in:
@@ -141,9 +141,10 @@ function forwardLocationToPassengerSocket(
|
||||
'lng' => (float)$payload['lng'],
|
||||
];
|
||||
|
||||
$passengerSocketUrl = getenv('PASSENGER_SOCKET_INTERNAL_URL') ?: 'http://127.0.0.1:3031';
|
||||
$http = new AsyncHttp();
|
||||
$http->request(
|
||||
'http://127.0.0.1:3031',
|
||||
$passengerSocketUrl,
|
||||
[
|
||||
'method' => 'POST',
|
||||
'data' => http_build_query([
|
||||
@@ -237,12 +238,19 @@ $io->on('workerStart', function () use ($io, $INTERNAL_KEY) {
|
||||
$oldStatus = $ops['status_change']['old'];
|
||||
$newStatus = $ops['status_change']['new'];
|
||||
|
||||
// إزالة من المجموعة القديمة
|
||||
if ($oldStatus === 'on') $pipe->zrem('geo:drivers:busy', $driverId);
|
||||
if ($oldStatus === 'off') $pipe->zrem('geo:drivers:available', $driverId);
|
||||
|
||||
if ($newStatus === 'close' || $newStatus === 'blocked') {
|
||||
$pipe->zrem('geo:drivers:available', $driverId);
|
||||
$pipe->zrem('geo:drivers:busy', $driverId);
|
||||
} elseif ($newStatus === 'off') {
|
||||
// أصبح متاحاً → أضفه إلى geo:drivers:available
|
||||
$pipe->zadd('geo:drivers:available', 0, $driverId);
|
||||
} elseif ($newStatus === 'on') {
|
||||
// أصبح مشغولاً → أضفه إلى geo:drivers:busy
|
||||
$pipe->zadd('geo:drivers:busy', 0, $driverId);
|
||||
}
|
||||
}
|
||||
if (isset($ops['geoadd'])) {
|
||||
|
||||
Reference in New Issue
Block a user