1.没置顶的消息,到最上面去了 2.无法转发图片 3.用户ID 是一串字母+数字 4.视频无法显示 5.消息无法置顶 6.可以引用文字,无法艾特用户 7.图片点开只能显示一半 8.转发不能多选,只能一个个转发 9.转发有转发提示,需取消

This commit is contained in:
annali168290-ux
2026-10-11 00:26:07 +07:00
parent cf66f936e5
commit 1cabf661ca
29 changed files with 3906 additions and 1579 deletions
+22 -6
View File
@@ -97,26 +97,41 @@ function ensureMessageEditsTable(): void
function ensurePinnedMessagesTable(): void
{
imAppDb()->exec(
$db = imAppDb();
$db->exec(
'create table if not exists `t_web_pinned_messages` ('
. '`user_id` varchar(64) not null,'
. '`conversation_type` varchar(16) not null,'
. '`target_id` varchar(128) not null,'
. '`message_uid` varchar(32) not null,'
. '`message_json` text null,'
. '`updated_at_ms` bigint not null,'
. 'primary key (`user_id`, `conversation_type`, `target_id`)'
. ') engine=InnoDB default charset=utf8mb4'
);
try {
$db->exec('alter table `t_web_pinned_messages` add column `message_json` text null after `message_uid`');
} catch (Throwable) {
// The column already exists.
}
}
function savePinnedMessage(string $userId, string $conversationType, string $targetId, string $messageUid): void
function savePinnedMessage(string $userId, string $conversationType, string $targetId, string $messageUid, array $message): void
{
ensurePinnedMessagesTable();
$statement = imAppDb()->prepare(
'insert into `t_web_pinned_messages` (`user_id`, `conversation_type`, `target_id`, `message_uid`, `updated_at_ms`)'
. ' values (?, ?, ?, ?, ?) on duplicate key update `message_uid` = values(`message_uid`), `updated_at_ms` = values(`updated_at_ms`)'
'insert into `t_web_pinned_messages` (`user_id`, `conversation_type`, `target_id`, `message_uid`, `message_json`, `updated_at_ms`)'
. ' values (?, ?, ?, ?, ?, ?) on duplicate key update `message_uid` = values(`message_uid`),'
. ' `message_json` = values(`message_json`), `updated_at_ms` = values(`updated_at_ms`)'
);
$statement->execute([$userId, $conversationType, $targetId, $messageUid, nowTimestampMs()]);
$statement->execute([
$userId,
$conversationType,
$targetId,
$messageUid,
json_encode($message, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
nowTimestampMs(),
]);
}
function removePinnedMessage(string $userId, string $conversationType, string $targetId): void
@@ -263,7 +278,8 @@ try {
if ($targetId === '') respond(400, '缺少会话ID');
$userId = resolveActionUserId($userId);
if ($action === 'pin') {
savePinnedMessage($userId, $conversationType, $targetId, $messageUidText);
$message = is_array($payload['message'] ?? null) ? $payload['message'] : [];
savePinnedMessage($userId, $conversationType, $targetId, $messageUidText, $message);
} else {
removePinnedMessage($userId, $conversationType, $targetId);
}