diff --git a/app/Http/Controllers/Api/DialogController.php b/app/Http/Controllers/Api/DialogController.php
index e35cce563..3865a317a 100755
--- a/app/Http/Controllers/Api/DialogController.php
+++ b/app/Http/Controllers/Api/DialogController.php
@@ -214,7 +214,7 @@ class DialogController extends AbstractController
* @apiName msg__lists
*
* @apiParam {Number} dialog_id 对话ID
- * @apiParam {String} [position_id] 定位消息ID(填写时page无效)
+ * @apiParam {Number} [position_id] 定位消息ID(填写时page无效)
*
* @apiParam {Number} [page] 当前页,默认:1
* @apiParam {Number} [pagesize] 每页显示数量,默认:50,最大:100
@@ -284,6 +284,13 @@ class DialogController extends AbstractController
* @apiParam {Number} [prev_id] 此消息ID之前的数据
* @apiParam {Number} [next_id] 此消息ID之后的数据
* - position_id、prev_id、next_id 只有一个有效,优先循序为:position_id > prev_id > next_id
+ * @apiParam {String} [mtype] 消息类型
+ * - tag: 标记
+ * - text: 文本
+ * - image: 图片
+ * - file: 文件
+ * - record: 录音
+ * - meeting: 会议
*
* @apiParam {Number} [take] 获取条数,默认:50,最大:100
*
@@ -301,6 +308,7 @@ class DialogController extends AbstractController
$position_id = intval(Request::input('position_id'));
$prev_id = intval(Request::input('prev_id'));
$next_id = intval(Request::input('next_id'));
+ $mtype = trim(Request::input('mtype'));
$take = Base::getPaginate(100, 50, 'take');
$data = [];
//
@@ -317,6 +325,11 @@ class DialogController extends AbstractController
->on('read.msg_id', '=', 'web_socket_dialog_msgs.id');
})->where('web_socket_dialog_msgs.dialog_id', $dialog_id);
//
+ if ($mtype === 'tag') {
+ $builder->where('tag', '>', 0);
+ } elseif (in_array($mtype, ['text', 'image', 'file', 'record', 'meeting'])) {
+ $builder->whereMtype($mtype);
+ }
if ($msg_id > 0) {
$builder->whereReplyId($msg_id);
$reDialog = false;
diff --git a/app/Models/WebSocketDialogMsg.php b/app/Models/WebSocketDialogMsg.php
index 81e90d837..594addf2f 100644
--- a/app/Models/WebSocketDialogMsg.php
+++ b/app/Models/WebSocketDialogMsg.php
@@ -18,6 +18,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @property string|null $dialog_type 对话类型
* @property int|null $userid 发送会员ID
* @property string|null $type 消息类型
+ * @property string|null $mtype 消息类型(用于搜索)
* @property array|mixed $msg 详细消息
* @property array|mixed $emoji emoji回复
* @property string|null $key 搜索关键词
@@ -44,6 +45,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialogMsg whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialogMsg whereKey($value)
* @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialogMsg whereMsg($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialogMsg whereMtype($value)
* @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialogMsg whereRead($value)
* @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialogMsg whereReplyId($value)
* @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialogMsg whereReplyNum($value)
@@ -519,11 +521,20 @@ class WebSocketDialogMsg extends AbstractModel
*/
public static function sendMsg($dialog_id, $reply_id, $type, $msg, $sender = 0)
{
+ $mtype = $type;
+ if ($type === 'text' && str_contains($msg['text'], ' $dialog_id,
'reply_id' => $reply_id,
'userid' => $sender ?: User::userid(),
'type' => $type,
+ 'mtype' => $mtype,
'msg' => $msg,
'read' => 0,
]);
diff --git a/database/migrations/2022_06_30_172539_add_web_socket_dialog_msgs_mtype.php b/database/migrations/2022_06_30_172539_add_web_socket_dialog_msgs_mtype.php
new file mode 100644
index 000000000..844c65d0d
--- /dev/null
+++ b/database/migrations/2022_06_30_172539_add_web_socket_dialog_msgs_mtype.php
@@ -0,0 +1,56 @@
+string('mtype', 20)->nullable()->default('')->after('type')->comment('消息类型(用于搜索)');
+ }
+ });
+ if ($isAdd) {
+ DB::table('web_socket_dialog_msgs')->update([
+ 'mtype' => DB::raw('type')
+ ]);
+ DB::table('web_socket_dialog_msgs')->where('type', 'text')->where('msg', 'LIKE', '%
update([
+ 'mtype' => 'image'
+ ]);
+ DB::table('web_socket_dialog_msgs')->where('type', 'file')->where('msg', 'LIKE', '%.jpg"%')->update([
+ 'mtype' => 'image'
+ ]);
+ DB::table('web_socket_dialog_msgs')->where('type', 'file')->where('msg', 'LIKE', '%.jpeg"%')->update([
+ 'mtype' => 'image'
+ ]);
+ DB::table('web_socket_dialog_msgs')->where('type', 'file')->where('msg', 'LIKE', '%.png"%')->update([
+ 'mtype' => 'image'
+ ]);
+ DB::table('web_socket_dialog_msgs')->where('type', 'file')->where('msg', 'LIKE', '%.gif"%')->update([
+ 'mtype' => 'image'
+ ]);
+ }
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::table('web_socket_dialog_msgs', function (Blueprint $table) {
+ $table->dropColumn("mtype");
+ });
+ }
+}
diff --git a/resources/assets/js/pages/manage/components/DialogWrapper.vue b/resources/assets/js/pages/manage/components/DialogWrapper.vue
index ddc061584..faf44e221 100644
--- a/resources/assets/js/pages/manage/components/DialogWrapper.vue
+++ b/resources/assets/js/pages/manage/components/DialogWrapper.vue
@@ -11,7 +11,7 @@