Init Git Prod Mars 2026
This commit is contained in:
commit
d81efe93b1
362 files changed
+86627
No files matched your search
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
function push_queue_notification(
|
||||
PDO $pdo,
|
||||
array $target, // ['compte_id'=>?, 'role'=>?, 'reference_id'=>?] (tu peux passer 1 ou 2 champs)
|
||||
string $type,
|
||||
string $title,
|
||||
string $body,
|
||||
?string $url = null,
|
||||
?array $data = null
|
||||
): int {
|
||||
$stmt = $pdo->prepare("
|
||||
INSERT INTO push_notifications
|
||||
(target_role, target_reference_id, target_compte_id, type, title, body, url, data_json, status, created_at)
|
||||
VALUES
|
||||
(:role, :ref, :cid, :type, :title, :body, :url, :data, 'pending', NOW())
|
||||
");
|
||||
$stmt->execute([
|
||||
':role' => (string)($target['role'] ?? 'client'),
|
||||
':ref' => isset($target['reference_id']) ? (int)$target['reference_id'] : null,
|
||||
':cid' => isset($target['compte_id']) ? (int)$target['compte_id'] : null,
|
||||
':type' => $type,
|
||||
':title'=> $title,
|
||||
':body' => $body,
|
||||
':url' => $url,
|
||||
':data' => $data ? json_encode($data, JSON_UNESCAPED_UNICODE) : null,
|
||||
]);
|
||||
return (int)$pdo->lastInsertId();
|
||||
}
|
||||
Reference in new issue
Block a user