From a9680d246477316fa947faf8a52f76fa943d5ba3 Mon Sep 17 00:00:00 2001 From: wong <106998207@qq.com> Date: Wed, 24 Sep 2025 14:09:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B6=88=E6=81=AF=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Server/application/chukebao/config/route.php | 1 + .../chukebao/controller/MessageController.php | 46 ++++++++++++++++++- 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/Server/application/chukebao/config/route.php b/Server/application/chukebao/config/route.php index 202537e4..090ddec1 100644 --- a/Server/application/chukebao/config/route.php +++ b/Server/application/chukebao/config/route.php @@ -28,6 +28,7 @@ Route::group('v1/', function () { Route::group('message/', function () { Route::get('list', 'app\chukebao\controller\MessageController@getList'); // 获取好友列表 Route::get('readMessage', 'app\chukebao\controller\MessageController@readMessage'); // 读取消息 + Route::get('details', 'app\chukebao\controller\MessageController@details'); // 消息详情 }); //AI相关 diff --git a/Server/application/chukebao/controller/MessageController.php b/Server/application/chukebao/controller/MessageController.php index 531714f9..beffd1ed 100644 --- a/Server/application/chukebao/controller/MessageController.php +++ b/Server/application/chukebao/controller/MessageController.php @@ -97,11 +97,53 @@ class MessageController extends BaseController } Db::table('s2_wechat_message')->where($where)->update(['isRead' => 1]); - - return ResponseHelper::success([]); + } + + + public function details(){ + $wechatFriendId = $this->request->param('wechatFriendId', ''); + $wechatChatroomId = $this->request->param('wechatChatroomId', ''); + $wechatAccountId = $this->request->param('wechatAccountId', ''); + $page = $this->request->param('page', 1); + $limit = $this->request->param('limit', 10); + $from = $this->request->param('From', ''); + $to = $this->request->param('To', ''); + $olderData = $this->request->param('olderData', false); + $accountId = $this->getUserInfo('s2_accountId'); + if (empty($accountId)){ + return ResponseHelper::error('请先登录'); + } + if (empty($wechatChatroomId) && empty($wechatFriendId)){ + return ResponseHelper::error('参数缺失'); + } + + $where = []; + if (!empty($wechatChatroomId)){ + $where[] = ['wechatChatroomId','=',$wechatChatroomId]; + } + + if (!empty($wechatFriendId)){ + $where[] = ['wechatFriendId','=',$wechatFriendId]; + } + + if (!empty($From) && !empty($To)){ + $where[] = ['wechatTime','between',[$from,$to]]; + } + + + $list = Db::table('s2_wechat_message')->where($where)->page($page,$limit)->order('id DESC')->select(); + $total = Db::table('s2_wechat_message')->where($where)->count(); + + + foreach ($list as $k=>&$v){ + $v['wechatTime'] = !empty($v['wechatTime']) ? date('Y-m-d H:i:s',$v['wechatTime']) : ''; + } + + + return ResponseHelper::success(['total'=>$total,'list'=>$list]); }