feat: improve realtime messaging and media handling
This commit is contained in:
Vendored
+25
@@ -355,6 +355,31 @@ function fetchWebUserRemarkMap(PDO $db, string $ownerId, array $targetIds): arra
|
||||
return $remarks;
|
||||
}
|
||||
|
||||
function fetchImFriendAliasMap(PDO $db, string $ownerId, array $friendIds): array
|
||||
{
|
||||
$friendIds = array_values(array_unique(array_filter(array_map(static function ($friendId): string {
|
||||
return trim((string)$friendId);
|
||||
}, $friendIds))));
|
||||
if ($ownerId === '' || !$friendIds) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$aliases = [];
|
||||
foreach (array_chunk($friendIds, 500) as $chunk) {
|
||||
$statement = $db->prepare(
|
||||
'select `_friend_uid`, `_alias` from `t_friend`'
|
||||
. ' where `_uid` = ? and `_friend_uid` in (' . webImPlaceholders($chunk) . ') and `_state` = 0'
|
||||
);
|
||||
$statement->execute(array_merge([$ownerId], $chunk));
|
||||
|
||||
foreach ($statement->fetchAll() as $row) {
|
||||
$aliases[(string)$row['_friend_uid']] = trim((string)($row['_alias'] ?? ''));
|
||||
}
|
||||
}
|
||||
|
||||
return $aliases;
|
||||
}
|
||||
|
||||
function saveWebUserRemark(PDO $db, string $ownerId, string $targetId, string $alias): void
|
||||
{
|
||||
if ($ownerId === '' || $targetId === '') {
|
||||
|
||||
Reference in New Issue
Block a user