Browse Source

聊天记录日期时间筛选

master
wanghongjun 7 months ago
parent
commit
d5ed423cbe
  1. 9
      app/enterprise/controller/Im.php
  2. 5
      public/sql/database.sql

9
app/enterprise/controller/Im.php

@ -251,6 +251,15 @@ class Im extends BaseController
$where[] = ['type', '<>', 'event'];
}
}
if (isset($param['search_date'])) {
$search_date = strtotime($param['search_date']);
if ($search_date) {
$start_date = strtotime(date("Y-m-d 00:00:00", $search_date));
$end_date = strtotime(date("Y-m-d 23:59:59"));
$where[] = ['create_time', '>=', $start_date];
$where[] = ['create_time', '<=', $end_date];
}
}
// 群聊查询入群时间以后的消息
if($is_group==1){
$group_id = explode('-', $param['toContactId'])[1];

5
public/sql/database.sql

@ -148,7 +148,10 @@ CREATE TABLE `yu_message` (
`extends` json DEFAULT NULL COMMENT '消息扩展内容',
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态',
`del_user` text COLLATE utf8mb4_unicode_ci COMMENT '已删除成员',
`delete_time` int(11) NOT NULL DEFAULT '0' COMMENT '删除时间'
`delete_time` int(11) NOT NULL DEFAULT '0' COMMENT '删除时间',
`plain_text` text COLLATE utf8mb4_unicode_ci COMMENT '消息内容纯文本',
PRIMARY KEY (`msg_id`),
KEY `chat_identify` (`chat_identify`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------

Loading…
Cancel
Save