Update: 2026-06-11 18:22:57
This commit is contained in:
103
walletintaleq.intaleq.xyz/v2/main/Admin/AdminCaptain/get.php
Normal file
103
walletintaleq.intaleq.xyz/v2/main/Admin/AdminCaptain/get.php
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
include "../../connect.php";
|
||||
|
||||
$sql = "SELECT
|
||||
`driver`.`id`,
|
||||
`driver`.`phone`,
|
||||
`driver`.`email`,
|
||||
`driver`.`gender`,
|
||||
`driver`.`status`,
|
||||
`driver`.`birthdate`,
|
||||
`driver`.`site`,
|
||||
`driver`.`first_name`,
|
||||
`driver`.`last_name`,
|
||||
`driver`.`education`,
|
||||
`driver`.`employmentType`,
|
||||
`driver`.`maritalStatus`,
|
||||
`driver`.`created_at`,
|
||||
`driver`.`updated_at`,
|
||||
(
|
||||
SELECT
|
||||
COUNT(`driver`.`id`)
|
||||
FROM
|
||||
`driver`
|
||||
) AS countPassenger,
|
||||
(
|
||||
SELECT
|
||||
CAST(AVG(`rating`) AS DECIMAL(10, 2))
|
||||
FROM
|
||||
`ratingPassenger`
|
||||
WHERE
|
||||
`ratingPassenger`.`driverID` = `driver`.`id`
|
||||
) AS ratingPassenger,
|
||||
(
|
||||
SELECT
|
||||
COUNT(`ratingPassenger`.`driverID`)
|
||||
FROM
|
||||
`ratingPassenger`
|
||||
WHERE
|
||||
`ratingPassenger`.`driverID` = `driver`.`id`
|
||||
) AS countDriverRate,
|
||||
(
|
||||
SELECT
|
||||
COUNT(`canecl`.`driverID`)
|
||||
FROM
|
||||
`canecl`
|
||||
WHERE
|
||||
`canecl`.`driverID` = `driver`.`id`
|
||||
) AS countPassengerCancel,
|
||||
(
|
||||
SELECT
|
||||
CAST(
|
||||
AVG(`ratingDriver`.`rating`) AS DECIMAL(10, 2)
|
||||
)
|
||||
FROM
|
||||
`ratingDriver`
|
||||
WHERE
|
||||
`ratingDriver`.`driver_id` = `driver`.`id`
|
||||
) AS passengerAverageRating,
|
||||
(
|
||||
SELECT
|
||||
COUNT(`ratingDriver`.`driver_id`)
|
||||
FROM
|
||||
`ratingDriver`
|
||||
WHERE
|
||||
`ratingDriver`.`driver_id` = `driver`.`id`
|
||||
) AS countPassengerRate,
|
||||
(
|
||||
SELECT
|
||||
COUNT(`ride`.`driver_id`)
|
||||
FROM
|
||||
`ride`
|
||||
WHERE
|
||||
`ride`.`driver_id` = `driver`.`id`
|
||||
) AS countPassengerRide,
|
||||
(
|
||||
SELECT
|
||||
`token`
|
||||
FROM
|
||||
`driverToken`
|
||||
WHERE
|
||||
`driverToken`.`captain_id` = `driver`.`id`
|
||||
) AS passengerToken
|
||||
FROM
|
||||
`driver`
|
||||
|
||||
ORDER BY
|
||||
passengerAverageRating
|
||||
DESC
|
||||
LIMIT 10";
|
||||
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($stmt->rowCount() > 0) {
|
||||
// Print all the records
|
||||
// printData($result);
|
||||
printSuccess($data = $result);
|
||||
} else {
|
||||
// Print a failure message
|
||||
printFailure($message = "No records found");
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
include "../../connect.php";
|
||||
|
||||
$driver_id = filterRequest("driver_id");
|
||||
$driverEmail = filterRequest("driverEmail");
|
||||
$driverPhone = filterRequest("driverPhone");
|
||||
|
||||
$sql = "SELECT
|
||||
`driver`.`id`,
|
||||
`driver`.`phone`,
|
||||
`driver`.`email`,
|
||||
`driver`.`gender`,
|
||||
`driver`.`status`,
|
||||
`driver`.`birthdate`,
|
||||
`driver`.`site`,
|
||||
`driver`.`first_name`,
|
||||
`driver`.`last_name`,
|
||||
`driver`.`education`,
|
||||
`driver`.`employmentType`,
|
||||
`driver`.`maritalStatus`,
|
||||
`driver`.`created_at`,
|
||||
`driver`.`updated_at`,
|
||||
(
|
||||
SELECT
|
||||
COUNT(`driver`.`id`)
|
||||
FROM
|
||||
`driver`
|
||||
) AS countPassenger,
|
||||
(
|
||||
SELECT
|
||||
CAST(AVG(`rating`) AS DECIMAL(10, 2))
|
||||
FROM
|
||||
`ratingPassenger`
|
||||
WHERE
|
||||
`ratingPassenger`.`driverID` = `driver`.`id`
|
||||
) AS ratingPassenger,
|
||||
(
|
||||
SELECT
|
||||
COUNT(`ratingPassenger`.`driverID`)
|
||||
FROM
|
||||
`ratingPassenger`
|
||||
WHERE
|
||||
`ratingPassenger`.`driverID` = `driver`.`id`
|
||||
) AS countDriverRate,
|
||||
(
|
||||
SELECT
|
||||
COUNT(`canecl`.`driverID`)
|
||||
FROM
|
||||
`canecl`
|
||||
WHERE
|
||||
`canecl`.`driverID` = `driver`.`id`
|
||||
) AS countPassengerCancel,
|
||||
(
|
||||
SELECT
|
||||
CAST(
|
||||
AVG(`ratingDriver`.`rating`) AS DECIMAL(10, 2)
|
||||
)
|
||||
FROM
|
||||
`ratingDriver`
|
||||
WHERE
|
||||
`ratingDriver`.`driver_id` = `driver`.`id`
|
||||
) AS passengerAverageRating,
|
||||
(
|
||||
SELECT
|
||||
COUNT(`ratingDriver`.`driver_id`)
|
||||
FROM
|
||||
`ratingDriver`
|
||||
WHERE
|
||||
`ratingDriver`.`driver_id` = `driver`.`id`
|
||||
) AS countPassengerRate,
|
||||
(
|
||||
SELECT
|
||||
COUNT(`ride`.`driver_id`)
|
||||
FROM
|
||||
`ride`
|
||||
WHERE
|
||||
`ride`.`driver_id` = `driver`.`id`
|
||||
) AS countPassengerRide,
|
||||
(
|
||||
SELECT
|
||||
`token`
|
||||
FROM
|
||||
`driverToken`
|
||||
WHERE
|
||||
`driverToken`.`captain_id` = `driver`.`id`
|
||||
) AS passengerToken
|
||||
FROM
|
||||
`driver`
|
||||
WHERE driver.email = '$driverEmail' OR driver.phone = '$driverPhone' OR driver.id = '$driver_id'
|
||||
|
||||
ORDER BY
|
||||
passengerAverageRating
|
||||
DESC
|
||||
LIMIT 10
|
||||
";
|
||||
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($stmt->rowCount() > 0) {
|
||||
// Print all the records
|
||||
// printData($result);
|
||||
printSuccess($data = $result);
|
||||
} else {
|
||||
// Print a failure message
|
||||
printFailure($message = "No records found");
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
include "../../connect.php";
|
||||
|
||||
$driver_id = filterRequest("driver_id");
|
||||
|
||||
$sql = "SELECT
|
||||
`driver`.`id`,
|
||||
`driver`.`phone`,
|
||||
`driver`.`email`,
|
||||
`driver`.`gender`,
|
||||
`driver`.`status`,
|
||||
`driver`.`birthdate`,
|
||||
`driver`.`site`,
|
||||
`driver`.`first_name`,
|
||||
`driver`.`last_name`,
|
||||
`driver`.`education`,
|
||||
`driver`.`employmentType`,
|
||||
`driver`.`maritalStatus`,
|
||||
`driver`.`created_at`,
|
||||
`driver`.`updated_at`,
|
||||
(
|
||||
SELECT
|
||||
COUNT(`driver`.`id`)
|
||||
FROM
|
||||
`driver`
|
||||
) AS countPassenger,
|
||||
(
|
||||
SELECT
|
||||
CAST(AVG(`rating`) AS DECIMAL(10, 2))
|
||||
FROM
|
||||
`ratingPassenger`
|
||||
WHERE
|
||||
`ratingPassenger`.`driverID` = `driver`.`id`
|
||||
) AS ratingPassenger,
|
||||
(
|
||||
SELECT
|
||||
COUNT(`ratingPassenger`.`driverID`)
|
||||
FROM
|
||||
`ratingPassenger`
|
||||
WHERE
|
||||
`ratingPassenger`.`driverID` = `driver`.`id`
|
||||
) AS countDriverRate,
|
||||
(
|
||||
SELECT
|
||||
COUNT(`canecl`.`driverID`)
|
||||
FROM
|
||||
`canecl`
|
||||
WHERE
|
||||
`canecl`.`driverID` = `driver`.`id`
|
||||
) AS countPassengerCancel,
|
||||
(
|
||||
SELECT
|
||||
CAST(
|
||||
AVG(`ratingDriver`.`rating`) AS DECIMAL(10, 2)
|
||||
)
|
||||
FROM
|
||||
`ratingDriver`
|
||||
WHERE
|
||||
`ratingDriver`.`driver_id` = `driver`.`id`
|
||||
) AS passengerAverageRating,
|
||||
(
|
||||
SELECT
|
||||
COUNT(`ratingDriver`.`driver_id`)
|
||||
FROM
|
||||
`ratingDriver`
|
||||
WHERE
|
||||
`ratingDriver`.`driver_id` = `driver`.`id`
|
||||
) AS countPassengerRate,
|
||||
(
|
||||
SELECT
|
||||
COUNT(`ride`.`driver_id`)
|
||||
FROM
|
||||
`ride`
|
||||
WHERE
|
||||
`ride`.`driver_id` = `driver`.`id`
|
||||
) AS countPassengerRide,
|
||||
(
|
||||
SELECT
|
||||
`token`
|
||||
FROM
|
||||
`driverToken`
|
||||
WHERE
|
||||
`driverToken`.`captain_id` = `driver`.`id`
|
||||
) AS passengerToken
|
||||
FROM
|
||||
`driver`
|
||||
WHERE
|
||||
driver.id = '$driver_id'
|
||||
ORDER BY
|
||||
passengerAverageRating
|
||||
DESC
|
||||
LIMIT 10
|
||||
";
|
||||
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($stmt->rowCount() > 0) {
|
||||
// Print all the records
|
||||
// printData($result);
|
||||
printSuccess($data = $result);
|
||||
} else {
|
||||
// Print a failure message
|
||||
printFailure($message = "No records found");
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user