added new fcp statistics

This commit is contained in:
2025-09-12 09:18:15 +02:00
parent 900b9232b4
commit 8e6ab15fef
5 changed files with 218 additions and 16 deletions
+21 -1
View File
@@ -1090,6 +1090,9 @@ class PreorderController extends mfBaseController {
case "saveStatusJournal":
$return = $this->saveStatusJournalApi();
break;
case "getRimoFcpStats":
$return = $this->getRimoFcpStatsApi();
break;
default:
$return = false;
}
@@ -1221,11 +1224,28 @@ class PreorderController extends mfBaseController {
if (!$campaign->id) return [];
return array_map(
fn($fcp) => ["id" => $fcp->name ?? null, "text" => $fcp->name ?? null, 'lat' => $fcp->gps_lat ?? null, 'lng' => $fcp->gps_long ?? null],
fn($fcp) => ["real_id" => $fcp->id, "id" => $fcp->name ?? null, "text" => $fcp->name ?? null, 'lat' => $fcp->gps_lat ?? null, 'lng' => $fcp->gps_long ?? null],
ADBRimoFcp::getAll(["netzgebiet_id" => intval($campaign->network->adb_netzgebiet_id)]) ?? []
);
}
public function getRimoFcpStatsApi() {
$this->postData = json_decode(file_get_contents("php://input"));
$stats = ADBRimoFcp::getRimoFcpStatistics();
if (!empty($this->postData->fcp_ids)) {
$fcpIds = (array) $this->postData->fcp_ids;
$stats = array_filter($stats, fn($item) => in_array($item['fcp_id'], $fcpIds));
}
foreach ($stats as &$item)
if (isset($item['counts_by_rimo_type']) && is_string($item['counts_by_rimo_type']))
$item['counts_by_rimo_type'] = json_decode($item['counts_by_rimo_type']);
unset($item);
return array_values($stats);
}
private function setBilledApi() {
$preorder_id = $this->request->id;