mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-13 12:02:51 +00:00
no message
This commit is contained in:
parent
f29bf3640a
commit
3c57cf8d81
@ -179,6 +179,7 @@ class DialogController extends AbstractController
|
|||||||
->join('web_socket_dialogs as d', 'u.dialog_id', '=', 'd.id')
|
->join('web_socket_dialogs as d', 'u.dialog_id', '=', 'd.id')
|
||||||
->join('web_socket_dialog_msgs as m', 'm.dialog_id', '=', 'd.id')
|
->join('web_socket_dialog_msgs as m', 'm.dialog_id', '=', 'd.id')
|
||||||
->where('u.userid', $user->userid)
|
->where('u.userid', $user->userid)
|
||||||
|
->where('m.bot', 0)
|
||||||
->whereNull('d.deleted_at')
|
->whereNull('d.deleted_at')
|
||||||
->whereRaw("MATCH({$prefix}m.key) AGAINST('{$against}' IN BOOLEAN MODE)")
|
->whereRaw("MATCH({$prefix}m.key) AGAINST('{$against}' IN BOOLEAN MODE)")
|
||||||
->orderByDesc('m.id')
|
->orderByDesc('m.id')
|
||||||
@ -1018,7 +1019,7 @@ class DialogController extends AbstractController
|
|||||||
* @apiParam {Number} [reply_id] 回复ID
|
* @apiParam {Number} [reply_id] 回复ID
|
||||||
* @apiParam {String} [reply_check] 配合 reply_id 使用,判断是否需要验证回复ID的有效性
|
* @apiParam {String} [reply_check] 配合 reply_id 使用,判断是否需要验证回复ID的有效性
|
||||||
* - no: 不进行判断,直接使用提供的 reply_id(默认)
|
* - no: 不进行判断,直接使用提供的 reply_id(默认)
|
||||||
* - yes: 进行判断,如果上一条消息的 ID 为 reply_id,则认为 reply_id 无效
|
* - yes: 进行判断,如果上一条消息(非机器人)的 ID 为 reply_id,则认为 reply_id 无效
|
||||||
* @apiParam {String} [silence] 是否静默发送
|
* @apiParam {String} [silence] 是否静默发送
|
||||||
* - no: 正常发送(默认)
|
* - no: 正常发送(默认)
|
||||||
* - yes: 静默发送
|
* - yes: 静默发送
|
||||||
|
|||||||
@ -33,9 +33,10 @@ class AddFulltextIndexToWebSocketDialogMsgsTable extends Migration
|
|||||||
$databaseName = env('DB_DATABASE');
|
$databaseName = env('DB_DATABASE');
|
||||||
|
|
||||||
// 查询 information_schema.statistics 表
|
// 查询 information_schema.statistics 表
|
||||||
|
$prefix = DB::getTablePrefix();
|
||||||
$indexExists = DB::table(DB::raw('information_schema.statistics'))
|
$indexExists = DB::table(DB::raw('information_schema.statistics'))
|
||||||
->where('table_schema', $databaseName)
|
->where('table_schema', $databaseName)
|
||||||
->where('table_name', $tableName)
|
->where('table_name', $prefix . $tableName)
|
||||||
->where('index_type', 'FULLTEXT')
|
->where('index_type', 'FULLTEXT')
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class AddBotToWebSocketDialogMsgs extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('web_socket_dialog_msgs', function (Blueprint $table) {
|
||||||
|
if (!Schema::hasColumn('web_socket_dialog_msgs', 'bot')) {
|
||||||
|
$table->tinyInteger('bot')->default(0)->after('modify');
|
||||||
|
$table->index('bot');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 获取表前缀
|
||||||
|
$prefix = DB::getTablePrefix();
|
||||||
|
|
||||||
|
// 使用原生SQL更新数据
|
||||||
|
/** @noinspection SqlNoDataSourceInspection */
|
||||||
|
DB::statement("
|
||||||
|
UPDATE {$prefix}web_socket_dialog_msgs m
|
||||||
|
INNER JOIN {$prefix}users u ON u.userid = m.userid
|
||||||
|
SET m.bot = 1
|
||||||
|
WHERE u.bot = 1
|
||||||
|
");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('web_socket_dialog_msgs', function (Blueprint $table) {
|
||||||
|
if (Schema::hasColumn('web_socket_dialog_msgs', 'bot')) {
|
||||||
|
$table->dropIndex('bot');
|
||||||
|
$table->dropColumn('bot');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user