perf: 优化会议

This commit is contained in:
Pang 2024-04-08 09:35:14 +08:00
parent b7dcb543f6
commit 9acafed459
4 changed files with 12 additions and 3 deletions

View File

@ -957,6 +957,14 @@ class WebSocketDialogMsg extends AbstractModel
$dialogMsg->key = $dialogMsg->generateMsgKey();
$dialogMsg->save();
//
if ($dialogMsg->type === 'meeting') {
MeetingMsg::createInstance([
'meetingid' => $dialogMsg->msg['meetingid'],
'dialog_id' => $dialogMsg->dialog_id,
'msg_id' => $dialogMsg->id,
])->save();
}
//
WebSocketDialogUser::whereDialogId($dialogMsg->dialog_id)->change([
'hide' => 0, // 有新消息时,显示会话(会话内所有会员)
'last_at' => Carbon::now(),

View File

@ -64,7 +64,8 @@ class CloseMeetingRoomTask extends AbstractTask
->chunk(100, function ($msgs) use ($newMsg, &$dialogIds) {
/** @var WebSocketDialogMsg $msg */
foreach ($msgs as $msg) {
$msg->msg = Base::array2json($newMsg);
$msgData = Base::json2array($msg->getRawOriginal('msg'));
$msg->msg = Base::array2json(array_merge($msgData, $newMsg));
$msg->save();
//
if (!isset($dialogIds[$msg->dialog_id])) {

View File

@ -401,7 +401,7 @@ export default {
if (changedDevice.state === "ACTIVE") {
this.localUser.audioTrack?.setDevice(changedDevice.device.deviceId);
// Switch to an existing device when the current device is unplugged.
} else if (changedDevice.device.label === this.localUser.audioTrack.getTrackLabel()) {
} else if (changedDevice.device.label === this.localUser.audioTrack?.getTrackLabel()) {
const oldMicrophones = await AgoraRTC.getMicrophones();
oldMicrophones[0] && this.localUser.audioTrack?.setDevice(oldMicrophones[0].deviceId);
}
@ -412,7 +412,7 @@ export default {
if (changedDevice.state === "ACTIVE") {
this.localUser.videoTrack?.setDevice(changedDevice.device.deviceId);
// Switch to an existing device when the current device is unplugged.
} else if (changedDevice.device.label === this.localUser.videoTrack.getTrackLabel()) {
} else if (changedDevice.device.label === this.localUser.videoTrack?.getTrackLabel()) {
const oldCameras = await AgoraRTC.getCameras();
oldCameras[0] && this.localUser.videoTrack?.setDevice(oldCameras[0].deviceId);
}