diff --git a/core/Services/FcmService.php b/core/Services/FcmService.php index 4c32e84..c178a80 100644 --- a/core/Services/FcmService.php +++ b/core/Services/FcmService.php @@ -57,10 +57,6 @@ class FcmService $payload = [ 'message' => [ 'token' => $token, - 'notification' => [ - 'title' => $title, - 'body' => $body, - ], 'data' => $processedData, 'android' => ['priority' => 'HIGH'], 'apns' => [ @@ -70,6 +66,13 @@ class FcmService ], ]; + if (!empty($title) && !empty($body)) { + $payload['message']['notification'] = [ + 'title' => $title, + 'body' => $body, + ]; + } + $ch = curl_init($fcmUrl); curl_setopt_array($ch, [ CURLOPT_POST => true, diff --git a/functions.php b/functions.php index 73eb5d9..5d42e9a 100755 --- a/functions.php +++ b/functions.php @@ -60,6 +60,8 @@ function findBestDrivers($con, $lat, $lng, $carType) { $info = curl_getinfo($ch); curl_close($ch); + error_log("[findBestDrivers] HTTP Code: " . $info['http_code'] . " Response: " . $response); + if ($info['http_code'] !== 200) return []; $json = json_decode($response, true); diff --git a/loginWallet.php b/loginWallet.php index d7b5434..c880946 100755 --- a/loginWallet.php +++ b/loginWallet.php @@ -68,7 +68,6 @@ try { $payload = [ 'user_id' => $id, - 'sub' => $id, 'fingerPrint' => $fpHash, 'exp' => time() + 300, // 5 دقائق تم إصلاحه 'iat' => time(), @@ -84,6 +83,7 @@ try { $hmac = hash_hmac('sha256', $id, getenv('SECRET_KEY_HMAC')); jsonSuccess([ + 'status' => 'success', 'jwt' => $jwt, 'hmac' => $hmac, 'expires_in' => 300, diff --git a/scratch_test_find.php b/scratch_test_find.php new file mode 100644 index 0000000..194c00d --- /dev/null +++ b/scratch_test_find.php @@ -0,0 +1,13 @@ +geoadd('geo:rides:waiting', 36.0, 32.0, 'test_ride'); +$res = $redis->georadius('geo:rides:waiting', 36.0, 32.0, 10, 'km', ['WITHDIST' => true]); +print_r($res); +echo json_encode($res) . "\n";