From 278743fab352ba5deaf10a6dc5a53813aa92551e Mon Sep 17 00:00:00 2001 From: geyun <1556375442@qq.com> Date: Thu, 18 Dec 2025 13:37:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=8B=E6=9C=BA=E5=8F=B7=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E5=90=8E=E5=88=B7=E6=96=B0=E5=AD=98=E6=94=BE=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=8F=AF=E7=94=A8=E6=95=B0=E9=87=8F=E7=9A=84?= =?UTF-8?q?map?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 44 +++++++++++++------ middle.html | 19 ++++---- server2.js | 124 +++++++++++++++++++++++++++++++--------------------- 3 files changed, 115 insertions(+), 72 deletions(-) diff --git a/index.html b/index.html index 9c849b3..b26b7bf 100755 --- a/index.html +++ b/index.html @@ -1609,7 +1609,6 @@ const weixinloading = document.querySelector(".weixin-loading") let controller = null; let sessIdList = []; - let openId = ''; let isStopped = false;//是否停止输出 let isUpload = {}; let hasImage = false; @@ -1621,6 +1620,8 @@ console.log(params.get("userId"), 644, params.get("nickname"), params.get("headingimg")); const encodedUserId = params.get("userId"); + let openId= params.get("openid")?params.get("openid"):''; + const from = params.get("from"); let token = params.get("token");//app的token let localtoken = params.get("localtoken");//公众号的localtoken @@ -1748,6 +1749,7 @@ // setCookie('token', res.token); unshowpop(); // getSessionList(); + refreshAiChatNum() } // } else { @@ -2044,6 +2046,7 @@ if (!sessIdList || sessIdList.length == 0) { activeChatId = null; chatMessages.innerHTML = ""; + weixinloading.classList.add("none"); return; } // if (isNew == "new") { @@ -2724,6 +2727,17 @@ } } + async function refreshAiChatNum() { + const data = { + userId: userId + } + const res = await fetch("https://serviceai.satabot.com/refreshAiChatNum", { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify(data) // ✅ 加上 signal + }); + } + function showpop() { let html = `
@@ -2928,6 +2942,9 @@ // credentials: 'include', // 发送 cookie // body: JSON.stringify(sendParam), }).then(res => res.json()).then(data => { + if (!weixinloading.classList.contains("none")) { + weixinloading.classList.add("none"); + } // chats = data.messages; // renderChatList(); if (controller) return; @@ -3070,7 +3087,6 @@ // 请求成功,渲染页面 console.log('获取会话列表成功'); sessIdList = data.sessions; - weixinloading.classList.add("none"); renderChatList(); }) @@ -3219,19 +3235,19 @@ } }); - window.addEventListener('beforeunload', function (event) { - const data = { - userId: userId - } - const res = fetch('https://serviceai.satabot.com/updateAiChatNum', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify(data) - }); + // window.addEventListener('beforeunload', function (event) { + // const data = { + // userId: userId + // } + // const res = fetch('https://serviceai.satabot.com/updateAiChatNum', { + // method: 'POST', + // headers: { 'Content-Type': 'application/json' }, + // body: JSON.stringify(data) + // }); + // localStorage.setItem('remainChatNum', JSON.stringify(data)); - console.log(res, 98888); - debugger; - }) + + // }) diff --git a/middle.html b/middle.html index 5addfab..f646b70 100644 --- a/middle.html +++ b/middle.html @@ -8,7 +8,7 @@ - + @@ -654,7 +654,7 @@