This commit is contained in:
Hamza-Ayed
2026-04-29 01:00:29 +03:00
parent f2ee38ccee
commit 10d69033dd
5 changed files with 33 additions and 5 deletions

View File

@@ -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,

View File

@@ -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);

View File

@@ -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,

13
scratch_test_find.php Normal file
View File

@@ -0,0 +1,13 @@
<?php
require_once __DIR__ . '/../core/bootstrap.php';
require_once __DIR__ . '/../functions.php';
$con = Database::get('main');
$lat = 32.11171;
$lng = 36.06737;
$carType = 'Fixed Price';
echo "Testing findBestDrivers...\n";
$drivers = findBestDrivers($con, $lat, $lng, $carType);
print_r($drivers);
echo "Done.\n";

10
scratch_test_redis.php Normal file
View File

@@ -0,0 +1,10 @@
<?php
require_once __DIR__ . '/../core/bootstrap.php';
$redis = getRedis(); // or however it's connected in bootstrap
if (!$redis) {
echo "No redis\n"; exit;
}
$redis->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";