قرار المالك 2026-07-27: باك إند سيرو PHP هو المعتمد، وتطبيقاته المجرّبة ميدانياً تحل محل إعادة البناء المؤرشفة. سيرو نفسه لم يُمسّ. الخريطة: backend · payment_server · loction_server · ride_server · passenger_server · docker · dashboard · stress_test → الجذر siro_rider → apps/rider siro_driver → apps/driver siro_admin → dashboards/admin siro_service → dashboards/service android_bot → apps/android_bot socialBot → apps/socialBot نُسخ المتعقَّب في git سيرو فقط عبر `git archive` (3,198 ملفاً / ~169 م.ب) لا `cp -r` — فاستُثنيت مخلفات البناء تلقائياً. بلا أي تعديل محتوى عمداً: كل ما يلي يصير فرقاً مقروءاً مقابل المصدر. لم يُستورد وسببه: siromove.com (الموقع التسويقي يبقى marketing/ في تريبز، سيرو فيه 8 ملفات) · docs و planning (تريبز له docs/ الخاص) · deploy.sh (ليس نشراً على سيرفر بل `git add . && git push origin --all` — فخّ في مستودع آخر) · transit_dashboard (بانتظار قرار مصير backend-transit و dashboards/transit-web). ⚠️ لا يبني بعد — ثلاثة نواقص متوقعة ومقصودة: 1. `.env` و `lib/env/env.g.dart` غير متعقَّبين في سيرو (أسرار لكل مستأجر): كل تطبيق فلاتر يحتاج .env خاصاً ثم توليد env.g.dart بـ build_runner. 2. إعدادات Firebase (9 ملفات google-services.json و GoogleService-Info.plist) يستبعدها .gitignore تريبز — ولكل مستأجر مشروع Firebase خاص أصلاً. 3. apps/driver في سيرو يشير إلى `../../Intaleq/packages/get` خارج المستودع → يجب ضمّ الحزم داخله أسوة بـ apps/rider. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
110 lines
4.7 KiB
PHP
110 lines
4.7 KiB
PHP
<?php
|
|
require_once __DIR__ . '/../connect.php';
|
|
|
|
$phone = filterRequest("phone");
|
|
$phoneEncrypted = $encryptionHelper->encryptData($phone);
|
|
|
|
$sql = "SELECT
|
|
p.*,
|
|
COALESCE(r.id, 0) AS ride_id,
|
|
COALESCE(r.start_location, '') AS start_location,
|
|
COALESCE(r.end_location, '') AS end_location,
|
|
COALESCE(r.date, '1970-01-01') AS ride_date,
|
|
COALESCE(r.time, '00:00:00') AS ride_time,
|
|
COALESCE(r.endtime, '00:00:00') AS ride_endtime,
|
|
COALESCE(r.price, 0) AS price,
|
|
COALESCE(r.passenger_id, 0) AS ride_passenger_id,
|
|
COALESCE(r.driver_id, 0) AS driver_id,
|
|
COALESCE(r.status, '') AS ride_status,
|
|
COALESCE(r.paymentMethod, '') AS ride_payment_method,
|
|
COALESCE(r.carType, '') AS car_type,
|
|
COALESCE(r.created_at, '1970-01-01 00:00:00') AS ride_created_at,
|
|
COALESCE(r.updated_at, '1970-01-01 00:00:00') AS ride_updated_at,
|
|
COALESCE(r.DriverIsGoingToPassenger, 0) AS driver_is_going_to_passenger,
|
|
COALESCE(r.rideTimeStart, '1970-01-01 00:00:00') AS ride_time_start,
|
|
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
|
|
FROM
|
|
passengers p
|
|
LEFT JOIN
|
|
ride r ON p.id = r.passenger_id AND r.id = (
|
|
SELECT id
|
|
FROM ride
|
|
WHERE passenger_id = p.id
|
|
ORDER BY date DESC, time DESC
|
|
LIMIT 1
|
|
)
|
|
WHERE
|
|
p.phone = :phone";
|
|
|
|
$stmt = $con->prepare($sql);
|
|
$stmt->bindParam(':phone', $phoneEncrypted);
|
|
$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']);
|
|
if (isset($row['gender'])) $row['gender'] = $encryptionHelper->decryptData($row['gender']);
|
|
if (isset($row['birthdate'])) $row['birthdate'] = $encryptionHelper->decryptData($row['birthdate']);
|
|
if (isset($row['site'])) $row['site'] = $encryptionHelper->decryptData($row['site']);
|
|
if (isset($row['first_name'])) $row['first_name'] = $encryptionHelper->decryptData($row['first_name']);
|
|
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($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);
|
|
} else {
|
|
jsonError("No passenger found");
|
|
}
|
|
?>
|