نسخة كاملة من مستودع سيرو عند 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>
44 lines
1.3 KiB
PHP
Executable File
44 lines
1.3 KiB
PHP
Executable File
<?php
|
|
include "../../connect.php";
|
|
|
|
$driver_id = filterRequest("driver_id");
|
|
|
|
$current_month = date('m');
|
|
$current_year = date('Y');
|
|
|
|
// Get the first and last days of the current month.
|
|
$first_day_of_month = date('Y-m-d', strtotime($current_year . '-' . $current_month . '-01'));
|
|
$last_day_of_month = date('Y-m-d', strtotime($current_year . '-' . $current_month . '-' . cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year)));
|
|
|
|
// Create a SQL query to select the total duration for the driver for each day in the current month.
|
|
$sql = "SELECT
|
|
DATE(created_at) AS day,
|
|
SEC_TO_TIME(COUNT(*) * 60) AS total_duration
|
|
FROM
|
|
car_tracks
|
|
WHERE
|
|
car_tracks.driver_id = :driver_id
|
|
AND car_tracks.created_at >= :first_day_of_month
|
|
AND car_tracks.created_at < :last_day_of_month
|
|
GROUP BY
|
|
day
|
|
ORDER BY
|
|
day ASC;";
|
|
|
|
$stmt = $con->prepare($sql);
|
|
$stmt->bindParam(':driver_id', $driver_id, PDO::PARAM_STR);
|
|
$stmt->bindParam(':first_day_of_month', $first_day_of_month, PDO::PARAM_STR);
|
|
$stmt->bindParam(':last_day_of_month', $last_day_of_month, PDO::PARAM_STR);
|
|
$stmt->execute();
|
|
|
|
$car_locations = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
if ($car_locations) {
|
|
// Print the car location data as JSON
|
|
printSuccess($data = $car_locations);
|
|
} else {
|
|
// Print a failure message
|
|
printFailure($message = "No car locations found");
|
|
}
|
|
|
|
?>
|