Files
im/app/command/CheckConversation.php
T

61 lines
2.0 KiB
PHP
Raw Normal View History

2026-04-06 04:35:35 +08:00
<?php
namespace app\command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class CheckConversation extends Command
{
protected static $defaultName = 'check-conversation';
protected static $defaultDescription = '检查 conversation 记录';
protected function execute(InputInterface $input, OutputInterface $output): int
{
$conversationId = 'sg_2639473367';
$ownerUserId = '83484627';
cp("=== 检查 conversation 表记录 ===");
$convModel = new \app\model\Openim\Conversation();
$conv = $convModel->where('conversation_id', $conversationId)
->where('owner_user_id', $ownerUserId)
->find();
if ($conv) {
cp("找到记录:");
print_r($conv->toArray());
cp("");
if (isset($conv['max_seq'])) {
cp("max_seq: " . $conv['max_seq']);
} else {
cp("max_seq 不存在");
}
if (isset($conv['min_seq'])) {
cp("min_seq: " . $conv['min_seq']);
} else {
cp("min_seq 不存在");
}
} else {
cp("未找到记录");
cp("\n查找同一 conversation_id 的其他记录:");
$allConvs = $convModel->where('conversation_id', $conversationId)->select();
foreach ($allConvs as $c) {
cp("owner_user_id: " . ($c['owner_user_id'] ?? 'null'));
cp(" max_seq: " . ($c['max_seq'] ?? 'null'));
cp(" min_seq: " . ($c['min_seq'] ?? 'null'));
}
}
cp("\n=== 检查 seq 表 ===");
$seqModel = new \app\model\Openim\Seq();
$seq = $seqModel->where('conversation_id', $conversationId)->find();
if ($seq) {
cp("conversation_id: " . $seq['conversation_id']);
cp("max_seq: " . $seq['max_seq']);
cp("min_seq: " . $seq['min_seq']);
}
return 0;
}
}