1.没置顶的消息,到最上面去了 2.无法转发图片 3.用户ID 是一串字母+数字 4.视频无法显示 5.消息无法置顶 6.可以引用文字,无法艾特用户 7.图片点开只能显示一半 8.转发不能多选,只能一个个转发 9.转发有转发提示,需取消
This commit is contained in:
Vendored
+71
-13
@@ -425,12 +425,38 @@ function currentMuteSetting(PDO $appDb, string $groupId): array
|
||||
];
|
||||
}
|
||||
|
||||
function groupDetailAction(PDO $imDb, PDO $appDb, string $userId, string $groupId): array
|
||||
{
|
||||
$group = fetchWebGroup($appDb, $groupId);
|
||||
if (!$group) {
|
||||
respond(404, '没有找到该群组');
|
||||
}
|
||||
function groupDetailAction(PDO $imDb, PDO $appDb, string $userId, string $groupId): array
|
||||
{
|
||||
$group = fetchWebGroup($appDb, $groupId);
|
||||
if (!$group) {
|
||||
$groupStatement = $imDb->prepare('select * from `t_group` where `_gid` = ? and `_deleted` = 0 limit 1');
|
||||
$groupStatement->execute([$groupId]);
|
||||
$nativeGroup = $groupStatement->fetch();
|
||||
$memberStatement = $imDb->prepare('select `_type`, `_alias` from `t_group_member` where `_gid` = ? and `_mid` = ? limit 1');
|
||||
$memberStatement->execute([$groupId, $userId]);
|
||||
$nativeMember = $memberStatement->fetch();
|
||||
if (!$nativeGroup || !$nativeMember) {
|
||||
respond(403, '你不在该群组中');
|
||||
}
|
||||
$ownerStatement = $imDb->prepare('select `_mid` from `t_group_member` where `_gid` = ? and `_type` = 2 limit 1');
|
||||
$ownerStatement->execute([$groupId]);
|
||||
$ownerId = (string)($ownerStatement->fetchColumn() ?: '');
|
||||
$users = fetchWebUserMap($imDb, array_filter([$ownerId, $userId]), $userId);
|
||||
return ['group' => [
|
||||
'groupId' => $groupId,
|
||||
'publicId' => (string)($nativeGroup['id'] ?? ''),
|
||||
'name' => (string)($nativeGroup['_name'] ?? $groupId),
|
||||
'category' => 'group',
|
||||
'announcement' => (string)($nativeGroup['_bulletin'] ?? ''),
|
||||
'welcomeText' => '',
|
||||
'ownerUid' => $ownerId,
|
||||
'ownerName' => (string)($users[$ownerId]['displayName'] ?? $ownerId),
|
||||
'myRole' => ((int)($nativeMember['_type'] ?? 0) === 2 ? 'owner' : ((int)($nativeMember['_type'] ?? 0) === 1 ? 'admin' : 'member')),
|
||||
'myAlias' => (string)($nativeMember['_alias'] ?? ''),
|
||||
'myDisplayName' => (string)($nativeMember['_alias'] ?? '') ?: (string)($users[$userId]['displayName'] ?? $userId),
|
||||
'muteSetting' => ['enabled' => false, 'mode' => 'off'],
|
||||
]];
|
||||
}
|
||||
$member = fetchWebGroupMember($appDb, $groupId, $userId);
|
||||
if (!$member) {
|
||||
respond(403, '你不在该群组中');
|
||||
@@ -443,8 +469,9 @@ function groupDetailAction(PDO $imDb, PDO $appDb, string $userId, string $groupI
|
||||
$myAlias = (string)($member['alias'] ?? '');
|
||||
|
||||
return [
|
||||
'group' => [
|
||||
'groupId' => (string)$group['group_id'],
|
||||
'group' => [
|
||||
'groupId' => (string)$group['group_id'],
|
||||
'publicId' => (string)($group['id'] ?? ''),
|
||||
'name' => (string)$group['name'],
|
||||
'category' => (string)$group['category'],
|
||||
'announcement' => (string)($group['announcement'] ?? ''),
|
||||
@@ -459,11 +486,42 @@ function groupDetailAction(PDO $imDb, PDO $appDb, string $userId, string $groupI
|
||||
];
|
||||
}
|
||||
|
||||
function groupMembersAction(PDO $imDb, PDO $appDb, string $userId, string $groupId): array
|
||||
{
|
||||
if (!fetchWebGroupMember($appDb, $groupId, $userId)) {
|
||||
respond(403, '你不在该群组中');
|
||||
}
|
||||
function groupMembersAction(PDO $imDb, PDO $appDb, string $userId, string $groupId): array
|
||||
{
|
||||
if (!fetchWebGroupMember($appDb, $groupId, $userId)) {
|
||||
$membership = $imDb->prepare('select 1 from `t_group_member` where `_gid` = ? and `_mid` = ? limit 1');
|
||||
$membership->execute([$groupId, $userId]);
|
||||
if (!$membership->fetchColumn()) {
|
||||
respond(403, '你不在该群组中');
|
||||
}
|
||||
$nativeStatement = $imDb->prepare(
|
||||
'select `_mid` as `user_id`, `_type`, `_alias`, `_create_dt` from `t_group_member`'
|
||||
. ' where `_gid` = ? order by (`_type` = 2) desc, `_create_dt` asc'
|
||||
);
|
||||
$nativeStatement->execute([$groupId]);
|
||||
$nativeMembers = $nativeStatement->fetchAll();
|
||||
$nativeUsers = fetchWebUserMap($imDb, array_column($nativeMembers, 'user_id'), $userId);
|
||||
return ['members' => array_map(static function (array $member) use ($nativeUsers): array {
|
||||
$uid = (string)$member['user_id'];
|
||||
$user = $nativeUsers[$uid] ?? ['displayName' => $uid, 'mobile' => '', 'portrait' => '', 'isContact' => false];
|
||||
$alias = trim((string)($member['_alias'] ?? ''));
|
||||
$type = (int)($member['_type'] ?? 0);
|
||||
return [
|
||||
'uid' => $uid,
|
||||
'role' => $type === 2 ? 'owner' : ($type === 1 ? 'admin' : 'member'),
|
||||
'alias' => $alias,
|
||||
'contactAlias' => trim((string)($user['contactAlias'] ?? '')),
|
||||
'friendAlias' => trim((string)($user['friendAlias'] ?? '')),
|
||||
'remarkAlias' => trim((string)($user['remarkAlias'] ?? '')),
|
||||
'isContact' => (bool)($user['isContact'] ?? false),
|
||||
'displayName' => trim((string)($user['contactAlias'] ?? '')) ?: ($alias ?: (string)$user['displayName']),
|
||||
'rawDisplayName' => (string)$user['displayName'],
|
||||
'groupDisplayName' => $alias,
|
||||
'mobile' => (string)($user['mobile'] ?? ''),
|
||||
'portrait' => (string)($user['portrait'] ?? ''),
|
||||
];
|
||||
}, $nativeMembers)];
|
||||
}
|
||||
|
||||
$statement = $appDb->prepare(
|
||||
'select `user_id`, `role`, `alias`, `joined_at_ms` from `t_web_group_members`'
|
||||
|
||||
Reference in New Issue
Block a user