From 38f285f2b07960fddd113adb9b97bc4eb622539b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E9=A3=9E=E6=B4=8B?= <15778543+xufeiyang6017@user.noreply.gitee.com> Date: Sat, 20 Dec 2025 16:30:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=81=8A=E5=A4=A9=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E9=A1=B5=E4=BB=8E=E5=AE=A2=E6=9C=8D=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E8=BF=9B=E5=85=A5=E6=97=B6=E6=95=B0=E6=8D=AE=E4=B8=8D=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/chat-detail/index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pages/chat-detail/index.js b/pages/chat-detail/index.js index aeb7d80..a9ab084 100644 --- a/pages/chat-detail/index.js +++ b/pages/chat-detail/index.js @@ -151,8 +151,12 @@ Page({ } } + // 重要修复:当有managerPhone时,应该使用managerPhone作为chatId传递给服务器 + // 因为服务器端查询需要的是手机号,而不是客服人员的ID + const chatIdForApi = this.data.managerPhone || this.data.chatId; + // 使用新添加的API获取聊天记录 - API.getChatMessages(this.data.chatId, userPhone).then(res => { + API.getChatMessages(chatIdForApi, userPhone).then(res => { if (Array.isArray(res)) { // 处理每条消息,确定发送者和格式化时间 const processedMessages = res.map(message => { @@ -256,7 +260,8 @@ Page({ const earliestTime = this.data.messages.length > 0 ? this.data.messages[0].originalTime : null; // 使用API获取更多聊天记录(带分页参数) - API.getChatMessages(this.data.chatId, userPhone, { before: earliestTime }).then(res => { + const chatIdForApi = this.data.managerPhone || this.data.chatId; + API.getChatMessages(chatIdForApi, userPhone, { before: earliestTime }).then(res => { if (Array.isArray(res) && res.length > 0) { // 处理每条消息,确定发送者和格式化时间 const processedMessages = res.map(message => {