手机号注册后刷新存放当前用户可用数量的map

This commit is contained in:
2025-12-18 13:37:02 +08:00
parent fd8d44e4ce
commit 278743fab3
3 changed files with 115 additions and 72 deletions

View File

@@ -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 = `<div class='popbox'>
@@ -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;
})
// })
</script>
</body>