Files
intaleq/payment_server/v2/main/ride/driverWallet/promotionDriver.php
T
Hamza-AyedandClaude Opus 5 92dc6b3641 chore: استيراد أولي من سيرو (ecfe7568) — بلا أي تعديل
نسخة كاملة من مستودع سيرو عند ecfe7568 لتكون أساس تطبيق «انطلق».
نُسخ المتعقَّب في git فقط (12,509 ملفاً / 302 م.ب) بـ git archive، لا
`cp -r` — فاستُثنيت تلقائياً مخلفات البناء (build · node_modules ·
.dart_tool · .gradle · Pods ≈ 10.7 غ.ب) وكل ما يستثنيه .gitignore.

هذا الكوميت **بلا أي تعديل عمداً** حتى يكون كل ما يليه فرقاً مقروءاً
مقابل سيرو الأصلي. سيرو نفسه لم يُمسّ.

⚠️ لا يبني بعد: `.env` و`lib/env/env.g.dart` غير متعقَّبين في سيرو (وهذا
صحيح — أسرار لكل مستأجر). كل تطبيق فلاتر هنا يحتاج .env خاصاً بانطلق ثم
توليد env.g.dart عبر build_runner. لا تُنسخ أسرار سيرو.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 05:10:29 +03:00

60 lines
1.9 KiB
PHP
Executable File

<?php
// Include the database connection file
include "../../connect.php";
// Get the request parameters
$driver_id = filterRequest("driver_id");
$payment_amount = filterRequest("payment_amount");
$timePromo = filterRequest("timePromo"); // Example: 'morning' or 'afternoon'
//$createdAt = date("Y-m-d H:i:s"); // Get the current date and time
$currentDate = date("Y-m-d"); // Current date for comparison
// Check if a promotion record for the same driver already exists today
$sqlCheck = "SELECT COUNT(*) FROM `driver_promotions` WHERE `driver_id` = :driver_id AND DATE(`created_at`) = :current_date
and timePromo=:timePromo
";
$stmtCheck = $con->prepare($sqlCheck);
$stmtCheck->execute(array(
':driver_id' => $driver_id,
':current_date' => $currentDate
':timePromo' =>$timePromo
));
$count = $stmtCheck->fetchColumn();
if ($count > 0) {
// A record exists for today, so prevent the insertion
printFailure("A promotion record for this driver already exists for today.");
} else {
// No record exists for today, so insert the new promotion
$sqlInsert = "INSERT INTO `driver_promotions` (
`driver_id`,
`payment_amount`,
`timePromo`
) VALUES (
:driver_id,
:payment_amount,
:timePromo
);";
// Prepare the insert statement
$stmtInsert = $con->prepare($sqlInsert);
$stmtInsert->execute(array(
':driver_id' => $driver_id,
':payment_amount' => $payment_amount,
':timePromo' => $timePromo,
':createdAt' => $createdAt
));
// Check if the query was successful
if ($stmtInsert->rowCount() > 0) {
// Print a success message
printSuccess("Promotion record saved successfully");
} else {
// Print a failure message
printFailure("Failed to save promotion record");
}
}
?>