Update: 2026-06-26 04:04:03
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../connect.php';
|
||||
|
||||
// استلام الرقم وتشفيره
|
||||
$phone = filterRequest("phone");
|
||||
$phoneEncrypted = $encryptionHelper->encryptData($phone);
|
||||
|
||||
@@ -26,12 +25,7 @@ $sql = "SELECT
|
||||
COALESCE(r.rideTimeFinish, '1970-01-01 00:00:00') AS ride_time_finish,
|
||||
COALESCE(r.price_for_driver, 0) AS price_for_driver,
|
||||
COALESCE(r.price_for_passenger, 0) AS price_for_passenger,
|
||||
COALESCE(r.distance, 0) AS distance,
|
||||
0 AS passenger_wallet_balance,
|
||||
0 AS passenger_payment_amount,
|
||||
'' AS passenger_payment_method,
|
||||
0 AS driver_payment_amount,
|
||||
'' AS driver_payment_method
|
||||
COALESCE(r.distance, 0) AS distance
|
||||
FROM
|
||||
passengers p
|
||||
LEFT JOIN
|
||||
@@ -42,7 +36,6 @@ LEFT JOIN
|
||||
ORDER BY date DESC, time DESC
|
||||
LIMIT 1
|
||||
)
|
||||
|
||||
WHERE
|
||||
p.phone = :phone";
|
||||
|
||||
@@ -53,7 +46,20 @@ $stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
// فك التشفير للحقول الحساسة
|
||||
$stmtKazan = $con->prepare("SELECT country FROM kazan LIMIT 1");
|
||||
$stmtKazan->execute();
|
||||
$kazan = $stmtKazan->fetch(PDO::FETCH_ASSOC) ?: ["country" => "Jordan"];
|
||||
$country = $kazan['country'] ?? 'Jordan';
|
||||
|
||||
$walletServer = "https://walletintaleq.intaleq.xyz";
|
||||
if (strtolower($country) == 'jordan') {
|
||||
$walletServer = getenv('WALLET_SERVER_JORDAN') ?: "https://walletintaleq.intaleq.xyz";
|
||||
} elseif (strtolower($country) == 'egypt') {
|
||||
$walletServer = getenv('WALLET_SERVER_EGYPT') ?: "https://walletintaleq.intaleq.xyz";
|
||||
} else {
|
||||
$walletServer = getenv('WALLET_SERVER_SYRIA') ?: "https://walletintaleq.intaleq.xyz";
|
||||
}
|
||||
|
||||
foreach ($rows as &$row) {
|
||||
if (isset($row['phone'])) $row['phone'] = $encryptionHelper->decryptData($row['phone']);
|
||||
if (isset($row['email'])) $row['email'] = $encryptionHelper->decryptData($row['email']);
|
||||
@@ -64,7 +70,37 @@ if ($stmt->rowCount() > 0) {
|
||||
if (isset($row['last_name'])) $row['last_name'] = $encryptionHelper->decryptData($row['last_name']);
|
||||
if (isset($row['employmentType']))$row['employmentType'] = $encryptionHelper->decryptData($row['employmentType']);
|
||||
if (isset($row['maritalStatus'])) $row['maritalStatus'] = $encryptionHelper->decryptData($row['maritalStatus']);
|
||||
unset($r['password']);
|
||||
unset($row['password']);
|
||||
|
||||
$passenger_id = $row['id'] ?? '';
|
||||
if (!empty($passenger_id)) {
|
||||
$walletUrl = "$walletServer/v2/main/ride/passengerWallet/get_s2s_wallet.php";
|
||||
$ch = curl_init($walletUrl);
|
||||
curl_setopt_array($ch, [
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_POSTFIELDS => http_build_query(["passenger_id" => $passenger_id]),
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_TIMEOUT => 5,
|
||||
CURLOPT_HTTPHEADER => [
|
||||
'Content-Type: application/x-www-form-urlencoded',
|
||||
'X-S2S-Api-Key: ' . getenv('S2S_SHARED_KEY')
|
||||
]
|
||||
]);
|
||||
$s2sRes = curl_exec($ch);
|
||||
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
curl_close($ch);
|
||||
|
||||
$totalWallet = 0.0;
|
||||
if ($httpCode === 200 && $s2sRes) {
|
||||
$resDecoded = json_decode($s2sRes, true);
|
||||
if ($resDecoded && isset($resDecoded['status']) && $resDecoded['status'] === 'success') {
|
||||
$totalWallet = (float)($resDecoded['message']['totalWallet'] ?? 0.0);
|
||||
}
|
||||
}
|
||||
$row['passenger_wallet_balance'] = $totalWallet;
|
||||
} else {
|
||||
$row['passenger_wallet_balance'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
jsonSuccess($rows);
|
||||
|
||||
Reference in New Issue
Block a user