Update: 2026-06-15 01:37:40

This commit is contained in:
Hamza-Ayed
2026-06-15 01:37:41 +03:00
parent f021ba5a35
commit 2321b78244
164 changed files with 1356 additions and 1560 deletions

View File

@@ -22,21 +22,9 @@ $sql = "SELECT
),
0) AS rating,
COALESCE(
(
SELECT SUM(pd.amount)
FROM `payments` pd
WHERE pd.driverID = d.id
),
0) AS totalPayment,
0 AS totalPayment,
COALESCE(
(
SELECT SUM(dw.amount)
FROM `driverWallet` dw
WHERE dw.driverID = d.id
),
0) AS totalDriverWallet,
0 AS totalDriverWallet,
COALESCE(
(
@@ -97,7 +85,22 @@ $stmt->execute();
if ($stmt->rowCount() > 0) {
$row = $stmt->fetchAll(PDO::FETCH_ASSOC);
// فك تشفير الحقول المهمة
// Get country from Kazan to determine wallet server
$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 ($row as &$r) {
if (isset($r['phone'])) $r['phone'] = $encryptionHelper->decryptData($r['phone']);
if (isset($r['email'])) $r['email'] = $encryptionHelper->decryptData($r['email']);
@@ -115,6 +118,35 @@ if ($stmt->rowCount() > 0) {
if (isset($r['address'])) $r['address'] = $encryptionHelper->decryptData($r['address']);
if (isset($r['vin'])) $r['vin'] = $encryptionHelper->decryptData($r['vin']);
unset($r['password']);
// S2S Wallet Balance Query
$driver_id = $r['id'] ?? '';
if (!empty($driver_id)) {
$walletUrl = "$walletServer/v2/main/ride/driverWallet/get_s2s_wallet_dashboard.php";
$ch = curl_init($walletUrl);
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query(["driverID" => $driver_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);
}
}
$r['totalDriverWallet'] = $totalWallet;
}
}
jsonSuccess($row);