fix: 无法打开项目的情况

This commit is contained in:
kuaifan 2024-11-07 22:26:21 +08:00
parent ff38be3187
commit a023c0b8bf
5 changed files with 42 additions and 3 deletions

View File

@ -117,6 +117,7 @@ class DialogController extends AbstractController
->join('web_socket_dialogs as d', 'u.dialog_id', '=', 'd.id')
->where('u.userid', $user->userid)
->where('d.name', 'LIKE', "%{$key}%")
->whereNull('d.deleted_at')
->orderByDesc('u.top_at')
->orderByDesc('u.last_at')
->take(20)
@ -174,6 +175,7 @@ class DialogController extends AbstractController
->join('web_socket_dialogs as d', 'u.dialog_id', '=', 'd.id')
->join('web_socket_dialog_msgs as m', 'm.dialog_id', '=', 'd.id')
->where('u.userid', $user->userid)
->whereNull('d.deleted_at')
->whereRaw("MATCH({$prefix}m.key) AGAINST('{$against}' IN BOOLEAN MODE)")
->orderByDesc('m.id')
->take(20 - count($list))
@ -209,6 +211,7 @@ class DialogController extends AbstractController
->join('web_socket_dialogs as d', 'u.dialog_id', '=', 'd.id')
->join('web_socket_dialog_msgs as m', 'm.dialog_id', '=', 'd.id')
->where('u.userid', $user->userid)
->whereNull('d.deleted_at')
->where('m.tag', '>', 0)
->orderByDesc('m.id')
->take(50)
@ -246,6 +249,7 @@ class DialogController extends AbstractController
->join('web_socket_dialogs as d', 'u.dialog_id', '=', 'd.id')
->where('u.userid', $user->userid)
->where('d.id', $dialog_id)
->whereNull('d.deleted_at')
->first();
return Base::retSuccess('success', WebSocketDialog::synthesizeData($item, $user->userid));
}

View File

@ -91,7 +91,8 @@ class WebSocketDialog extends AbstractModel
$builder = DB::table('web_socket_dialog_users as u')
->select(['d.*', 'u.top_at', 'u.last_at', 'u.mark_unread', 'u.silence', 'u.hide', 'u.color', 'u.updated_at as user_at'])
->join('web_socket_dialogs as d', 'u.dialog_id', '=', 'd.id')
->where('u.userid', $userid);
->where('u.userid', $userid)
->whereNull('d.deleted_at');
if ($updated) {
$builder->where('u.updated_at', '>', $updated);
}
@ -130,6 +131,7 @@ class WebSocketDialog extends AbstractModel
->join('web_socket_dialog_msg_reads as r', 'd.id', '=', 'r.dialog_id')
->where('u.userid', $userid)
->where('u.last_at', '<', $unreadAt)
->whereNull('d.deleted_at')
->where('r.userid', $userid)
->where('r.read_at')
->groupBy('u.dialog_id')
@ -148,6 +150,7 @@ class WebSocketDialog extends AbstractModel
->where('u.userid', $userid)
->where('u.mark_unread', 1)
->where('u.last_at', '<', $unreadAt)
->whereNull('d.deleted_at')
->take(20)
->get();
$list->transform(function ($item) use ($userid, &$ids, &$array) {
@ -165,6 +168,7 @@ class WebSocketDialog extends AbstractModel
->join('web_socket_dialog_msg_todos as t', 'd.id', '=', 't.dialog_id')
->where('u.userid', $userid)
->where('u.last_at', '<', $todoAt)
->whereNull('d.deleted_at')
->where('t.userid', $userid)
->where('t.done_at')
->groupBy('u.dialog_id')

View File

@ -322,6 +322,7 @@ class BotReceiveMsgTask extends AbstractTask
->join('web_socket_dialogs as d', 'u.dialog_id', '=', 'd.id')
->where('u.userid', $data->userid)
->where('d.name', 'LIKE', "%{$nameKey}%")
->whereNull('d.deleted_at')
->orderByDesc('u.top_at')
->orderByDesc('u.last_at')
->take(20)

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddIndexSome20241107 extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('web_socket_dialogs', function (Blueprint $table) {
$table->index('deleted_at');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
// 回滚数据 - 无法回滚
}
}

View File

@ -1189,7 +1189,7 @@ export default {
}
//
state.cacheDialogs.some(dialog => {
if (dialog.type == 'group' && dialog.group_type == 'project' && dialog.group_info.id == data.id) {
if (dialog.type == 'group' && dialog.group_type == 'project' && dialog.group_info && dialog.group_info.id == data.id) {
if (data.name !== undefined) {
dialog.name = data.name
}
@ -1586,7 +1586,7 @@ export default {
if (dialog.name === undefined || dialog.dialog_delete === 1) {
return false;
}
if (dialog.type == 'group' && dialog.group_type == 'task' && dialog.group_info.id == data.id) {
if (dialog.type == 'group' && dialog.group_type == 'task' && dialog.group_info && dialog.group_info.id == data.id) {
if (data.name !== undefined) {
dialog.name = data.name
}