Init Git Prod Mars 2026
This commit is contained in:
commit
d81efe93b1
362 files changed
+86627
No files matched your search
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
require_once __DIR__ . '/../_bootstrap.php';
|
||||
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
|
||||
$role = $GLOBALS['MESSAGES_CTX']['role'];
|
||||
$meId = $GLOBALS['MESSAGES_CTX']['me_id'];
|
||||
|
||||
if ($role === 'praticien') {
|
||||
$sql = "SELECT COALESCE(SUM(cc.p_unread),0)
|
||||
FROM conversations c
|
||||
LEFT JOIN conversation_counters cc ON cc.conversation_id = c.id
|
||||
WHERE c.praticien_id = ?
|
||||
AND c.deleted_for_praticien = 0";
|
||||
} else {
|
||||
$sql = "SELECT COALESCE(SUM(cc.c_unread),0)
|
||||
FROM conversations c
|
||||
LEFT JOIN conversation_counters cc ON cc.conversation_id = c.id
|
||||
WHERE c.client_id = ?
|
||||
AND c.deleted_for_client = 0";
|
||||
}
|
||||
$stmt = $pdo->prepare($sql);
|
||||
$stmt->execute([$meId]);
|
||||
$total = (int)$stmt->fetchColumn();
|
||||
|
||||
json_response(['total' => $total]);
|
||||
Reference in new issue
Block a user