公众号弹窗
This commit is contained in:
336
index.html
336
index.html
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0,user-scalable=no" />
|
||||||
<meta http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate">
|
<meta http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate">
|
||||||
<meta http-equiv="Pragma" content="no-cache">
|
<meta http-equiv="Pragma" content="no-cache">
|
||||||
<meta http-equiv="Expires" content="Thu, 01 Jan 1970 00:00:00 GMT">
|
<meta http-equiv="Expires" content="Thu, 01 Jan 1970 00:00:00 GMT">
|
||||||
@@ -12,9 +12,16 @@
|
|||||||
<!-- <script src=" https://res.wx.qq.com/connect/zh_CN/htmledition/js/wxopensdk.js"> -->
|
<!-- <script src=" https://res.wx.qq.com/connect/zh_CN/htmledition/js/wxopensdk.js"> -->
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- <script src="https://unpkg.com/vconsole@latest/dist/vconsole.min.js"></script> -->
|
<script src="https://unpkg.com/vconsole@latest/dist/vconsole.min.js"></script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
* {
|
||||||
|
touch-action: manipulation;
|
||||||
|
/* 允许平移和捏合缩放,但禁用双击缩放和长按 */
|
||||||
|
-webkit-tap-highlight-color: transparent;
|
||||||
|
/* 移除点击时的默认高亮(可选,优化体验) */
|
||||||
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-family: "Segoe UI", "PingFang SC", Arial, sans-serif;
|
font-family: "Segoe UI", "PingFang SC", Arial, sans-serif;
|
||||||
@@ -787,7 +794,8 @@
|
|||||||
|
|
||||||
/* 获取验证码按钮 */
|
/* 获取验证码按钮 */
|
||||||
.code-btn {
|
.code-btn {
|
||||||
border: 1px solid #1890ff;
|
border: none;
|
||||||
|
/* border: 1px solid #1890ff; */
|
||||||
background: white;
|
background: white;
|
||||||
padding: 5px 12px;
|
padding: 5px 12px;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
@@ -911,10 +919,45 @@
|
|||||||
z-index: 999999;
|
z-index: 999999;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.popbox .loading-box {
|
||||||
|
position: absolute;
|
||||||
|
top: 0px;
|
||||||
|
left: 0px;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
z-index: 999999999;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
background-color: #fff;
|
||||||
|
opacity: 0.7;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.popbox .loading-box.none {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.popbox .loading-box .loading {
|
||||||
|
border: solid #e2e8f0;
|
||||||
|
/* 浅灰色边框 */
|
||||||
|
border-top-color: #165DFF;
|
||||||
|
/* 蓝色顶部边框 */
|
||||||
|
border-radius: 50%;
|
||||||
|
animation: spin 1s linear infinite;
|
||||||
|
/* 旋转动画 */
|
||||||
|
display: inline-block;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#sms-form {
|
#sms-form {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<style>
|
<style>
|
||||||
@@ -940,6 +983,36 @@
|
|||||||
z-index: 999999;
|
z-index: 999999;
|
||||||
transition: all 0.3s ease-in-out;
|
transition: all 0.3s ease-in-out;
|
||||||
backdrop-filter: blur(2px);
|
backdrop-filter: blur(2px);
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.popbgc .loading-box {
|
||||||
|
position: absolute;
|
||||||
|
top: 0px;
|
||||||
|
left: 0px;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
z-index: 999999999;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.popbgc .loading-box.none {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.popbgc .loading-box .loading {
|
||||||
|
border: solid #e2e8f0;
|
||||||
|
/* 浅灰色边框 */
|
||||||
|
border-top-color: #165DFF;
|
||||||
|
/* 蓝色顶部边框 */
|
||||||
|
border-radius: 50%;
|
||||||
|
animation: spin 1s linear infinite;
|
||||||
|
/* 旋转动画 */
|
||||||
|
display: inline-block;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1006,6 +1079,10 @@
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.weixin-loading {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.popbgc {
|
.popbgc {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -1018,6 +1095,44 @@
|
|||||||
width: 90%;
|
width: 90%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.weixin-loading {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
position: fixed;
|
||||||
|
z-index: 99999;
|
||||||
|
background-color: #fff;
|
||||||
|
top: 0px;
|
||||||
|
left: 0px;
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.weixin-loading.none {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.weixin-loading .loading {
|
||||||
|
border: solid #e2e8f0;
|
||||||
|
/* 浅灰色边框 */
|
||||||
|
border-top-color: #165DFF;
|
||||||
|
/* 蓝色顶部边框 */
|
||||||
|
border-radius: 50%;
|
||||||
|
animation: spin 1s linear infinite;
|
||||||
|
/* 旋转动画 */
|
||||||
|
display: inline-block;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes spin {
|
||||||
|
to {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
@@ -1179,6 +1294,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="popbgc none">
|
<div class="popbgc none">
|
||||||
|
|
||||||
<div class="popup">
|
<div class="popup">
|
||||||
<h2>开启光伏运维智能化!</h2>
|
<h2>开启光伏运维智能化!</h2>
|
||||||
<form id="popupForm">
|
<form id="popupForm">
|
||||||
@@ -1221,18 +1337,23 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="weixin-loading none ">
|
||||||
|
<div class="loading">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<script src="./marked.min.js"></script>
|
<script src="./marked.min.js"></script>
|
||||||
<!-- <script>
|
<script>
|
||||||
// 开启 vConsole 调试面板
|
// 开启 vConsole 调试面板
|
||||||
var vConsole = new VConsole();
|
var vConsole = new VConsole();
|
||||||
|
|
||||||
console.log("✅ vConsole 已经启动");
|
console.log("✅ vConsole 已经启动");
|
||||||
</script> -->
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1246,6 +1367,7 @@
|
|||||||
const chatList = document.getElementById("chatList");
|
const chatList = document.getElementById("chatList");
|
||||||
let controller = null;
|
let controller = null;
|
||||||
let sessIdList = [];
|
let sessIdList = [];
|
||||||
|
let openId = '';
|
||||||
let isStopped = false;//是否停止输出
|
let isStopped = false;//是否停止输出
|
||||||
let isUpload = {};
|
let isUpload = {};
|
||||||
let hasImage = false;
|
let hasImage = false;
|
||||||
@@ -1272,7 +1394,9 @@
|
|||||||
let userId;
|
let userId;
|
||||||
if (from == "weixin") {
|
if (from == "weixin") {
|
||||||
userId = encodedUserId;
|
userId = encodedUserId;
|
||||||
document.querySelector('.logout').style.display = 'none';
|
openId = encodedUserId;
|
||||||
|
setCookie('openId', openId)
|
||||||
|
document.querySelector('.userinfo-panel .logout').style.display = 'none';
|
||||||
} else {
|
} else {
|
||||||
userId = decodeURIComponent(Number(escape(atob(encodedUserId))));
|
userId = decodeURIComponent(Number(escape(atob(encodedUserId))));
|
||||||
}
|
}
|
||||||
@@ -1327,29 +1451,144 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
function handleLogin(data) {
|
||||||
|
console.log("开始登录")
|
||||||
|
const loginParams = data;
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
fetch("/api/remote/login", {
|
||||||
|
method: "POST", // 必选:指定请求方法为 POST
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json", // 声明请求体是 JSON 格式
|
||||||
|
// 可选:如果接口需要 Token 前置验证,可添加 Authorization 头
|
||||||
|
// "Authorization": "Bearer 你的前置 Token"
|
||||||
|
},
|
||||||
|
// 必选:请求体,将参数对象转为 JSON 字符串(不能直接传对象)
|
||||||
|
body: JSON.stringify(loginParams)
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
console.log(res, 987)
|
||||||
|
if (!res.ok) {
|
||||||
|
throw new Error(`请求失败:${res.status} ${res.statusText}`);
|
||||||
|
}
|
||||||
|
return res.json(); // 只有 2xx 状态才解析 JSON
|
||||||
|
})
|
||||||
|
.then(data => {
|
||||||
|
console.log("登录回复")
|
||||||
|
resolve(data);
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
reject(err);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 发送验证码
|
||||||
|
|
||||||
|
function handleBind(num) {
|
||||||
|
const bindParams = {
|
||||||
|
phoneNumbers: num,
|
||||||
|
}
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
fetch("/api/remote/external/sms/sendAliSmsCode", {
|
||||||
|
method: "POST", // 必选:指定请求方法为 POST
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json", // 声明请求体是 JSON 格式
|
||||||
|
// 可选:如果接口需要 Token 前置验证,可添加 Authorization 头
|
||||||
|
// "Authorization": "Bearer 你的前置 Token"
|
||||||
|
},
|
||||||
|
// 必选:请求体,将参数对象转为 JSON 字符串(不能直接传对象)
|
||||||
|
body: JSON.stringify(bindParams)
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
|
||||||
|
if (!res.ok) {
|
||||||
|
throw new Error(`请求失败:${res.status} ${res.statusText}`);
|
||||||
|
}
|
||||||
|
return res.json(); // 只有 2xx 状态才解析 JSON
|
||||||
|
})
|
||||||
|
.then(data => {
|
||||||
|
resolve(data);
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
reject(err);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
// }
|
// }
|
||||||
|
function bindToLogin() {
|
||||||
|
debugger;
|
||||||
|
document.querySelector('.popbox .loading-box').classList.remove('none');
|
||||||
|
const data = {
|
||||||
|
sourceType: 5,
|
||||||
|
openId: openId,
|
||||||
|
phonenumber: document.getElementById('sys-phone').value,
|
||||||
|
smsCode: document.getElementById('code').value
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
handleLogin(data).then(res => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
document.querySelector('.popbox .loading-box').classList.add('none')
|
||||||
|
userId = res.userId;
|
||||||
|
setCookie('token', res.token);
|
||||||
|
unshowpop();
|
||||||
|
getSessionList();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
showToast(res.msg);
|
||||||
|
document.querySelector('.popbox .loading-box').classList.remove('none');
|
||||||
|
}
|
||||||
|
}).catch(err => {
|
||||||
|
|
||||||
|
// 捕获异步异常(如网络错误、接口报错、代码报错)
|
||||||
|
console.error("请求异常:", err);
|
||||||
|
showToast("登录失败,请重试" + err); // 给用户友好提示
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
unshowpop();
|
||||||
|
document.querySelector('.popbox .loading-box').classList.add('none');
|
||||||
|
});
|
||||||
|
|
||||||
|
} catch (err) {
|
||||||
|
console.error("请求异常:", err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function getUserByOpenId(id) {
|
function getUserByOpenId(id) {
|
||||||
|
const data = {
|
||||||
|
sourceType: 5,
|
||||||
|
openId: id,
|
||||||
|
|
||||||
|
phonenumber: '',
|
||||||
|
smsCode: '',
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
fetch("/api/getuserByopenid", {
|
handleLogin(data).then(res => {
|
||||||
method: "POST",
|
if (res.code == 300) {
|
||||||
headers: {
|
showpop();//出现验证码弹窗
|
||||||
"Content-Type": "application/json"
|
} else if (res.code == 200) {
|
||||||
},
|
setCookie('token', res.token);
|
||||||
body: JSON.stringify({
|
userId = res.userId;
|
||||||
userId: id,
|
|
||||||
|
|
||||||
})
|
|
||||||
}).then(res => res.json()).then(data => {
|
|
||||||
if (data.code == 0) {
|
|
||||||
|
|
||||||
userId = data.userId;
|
|
||||||
sendParam.userId = userId;
|
|
||||||
getSessionList();
|
|
||||||
} else {
|
|
||||||
console.error("未找到该用户:",);
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
// fetch("/api/getuserByopenid", {
|
||||||
|
// method: "POST",
|
||||||
|
// headers: {
|
||||||
|
// "Content-Type": "application/json"
|
||||||
|
// },
|
||||||
|
// body: JSON.stringify({
|
||||||
|
// userId: id,
|
||||||
|
|
||||||
|
// })
|
||||||
|
// }).then(res => res.json()).then(data => {
|
||||||
|
// if (data.code == 0) {
|
||||||
|
|
||||||
|
// userId = data.userId;
|
||||||
|
// sendParam.userId = userId;
|
||||||
|
// getSessionList();
|
||||||
|
// } else {
|
||||||
|
// console.error("未找到该用户:",);
|
||||||
|
// }
|
||||||
|
// })
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("请求异常:", err);
|
console.error("请求异常:", err);
|
||||||
}
|
}
|
||||||
@@ -1607,12 +1846,12 @@
|
|||||||
});
|
});
|
||||||
setTimeout(scrollToBottom, 0);
|
setTimeout(scrollToBottom, 0);
|
||||||
}
|
}
|
||||||
function setCookie(name, value) {
|
function setcookie(name, value) {
|
||||||
const d = new Date();
|
const d = new Date();
|
||||||
d.setFullYear(d.getFullYear() + 100); // +100 年
|
d.setFullYear(d.getFullYear() + 100); // +100 年
|
||||||
document.cookie = `${name}=${value};expires=${d.toUTCString()};path=/`;
|
document.cookie = `${name}=${value};expires=${d.toUTCString()};path=/`;
|
||||||
}
|
}
|
||||||
function getCookie(name) {
|
function getcookie(name) {
|
||||||
const cookies = document.cookie.split("; ");
|
const cookies = document.cookie.split("; ");
|
||||||
for (let c of cookies) {
|
for (let c of cookies) {
|
||||||
const [key, val] = c.split("=");
|
const [key, val] = c.split("=");
|
||||||
@@ -1627,9 +1866,9 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const cookieName = `popupClickCount_${userId}`;
|
const cookieName = `popupClickCount_${userId}`;
|
||||||
let clickCount = parseInt(getCookie(cookieName) || "0", 10);
|
let clickCount = parseInt(getcookie(cookieName) || "0", 10);
|
||||||
clickCount++;
|
clickCount++;
|
||||||
setCookie(cookieName, clickCount, 7);
|
setcookie(cookieName, clickCount, 7);
|
||||||
console.log(`用户 ${userId} 当前点击次数:`, clickCount);
|
console.log(`用户 ${userId} 当前点击次数:`, clickCount);
|
||||||
if (clickCount == 10) {
|
if (clickCount == 10) {
|
||||||
document.querySelector(".popbgc").classList.remove("none");
|
document.querySelector(".popbgc").classList.remove("none");
|
||||||
@@ -1747,6 +1986,8 @@
|
|||||||
// sendParam.userId= encodedUserId;
|
// sendParam.userId= encodedUserId;
|
||||||
if (from != "weixin") {
|
if (from != "weixin") {
|
||||||
sendParam.userId = decodeURIComponent(Number(escape(atob(encodedUserId))));
|
sendParam.userId = decodeURIComponent(Number(escape(atob(encodedUserId))));
|
||||||
|
} else {
|
||||||
|
sendParam.userId = userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ✅ 创建 AbortController
|
// ✅ 创建 AbortController
|
||||||
@@ -1890,6 +2131,7 @@
|
|||||||
}
|
}
|
||||||
function getSms() {
|
function getSms() {
|
||||||
let remainSeconds = 60;
|
let remainSeconds = 60;
|
||||||
|
|
||||||
let countTimer = setInterval(() => {
|
let countTimer = setInterval(() => {
|
||||||
if (remainSeconds > 0) {
|
if (remainSeconds > 0) {
|
||||||
remainSeconds--;
|
remainSeconds--;
|
||||||
@@ -1900,16 +2142,45 @@
|
|||||||
document.getElementById('send-code').textContent = "获取验证码";
|
document.getElementById('send-code').textContent = "获取验证码";
|
||||||
document.getElementById('send-code').disabled = false;
|
document.getElementById('send-code').disabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}, 1000)
|
}, 1000)
|
||||||
|
const phonenumber = document.getElementById('sys-phone').value;
|
||||||
|
handleBind(phonenumber).then(res => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
showToast(res.msg);
|
||||||
|
clearInterval(countTimer);
|
||||||
|
document.getElementById('send-code').textContent = "获取验证码";
|
||||||
|
document.getElementById('send-code').disabled = false;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
// showpop();
|
console.log(res);
|
||||||
|
}).catch(err => {
|
||||||
|
showToast(err);
|
||||||
|
clearInterval(countTimer);
|
||||||
|
document.getElementById('send-code').textContent = "获取验证码";
|
||||||
|
document.getElementById('send-code').disabled = false;
|
||||||
|
return;
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
function unshowpop() {
|
||||||
|
clearInterval(countTimer);
|
||||||
|
const popbox = document.querySelector('.popbox');
|
||||||
|
if (popbox) {
|
||||||
|
popbox.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function showpop() {
|
function showpop() {
|
||||||
let html = `<div class='popbox'>
|
let html = `<div class='popbox'>
|
||||||
|
|
||||||
<div class="form sms-form" id="sms-form">
|
<div class="form sms-form" id="sms-form">
|
||||||
<h2 style='margin:0px'>欢迎使用AI智能体</h2>
|
<div class="loading-box none">
|
||||||
|
<div class="loading"></div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<h2 style='margin:0px'>欢迎使用光伏运维智能体</h2>
|
||||||
<p style='color:#666;margin:13px 0px;'>请先绑定手机号</p>
|
<p style='color:#666;margin:13px 0px;'>请先绑定手机号</p>
|
||||||
|
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
@@ -1925,7 +2196,7 @@
|
|||||||
<button class="code-btn" id="send-code" onclick="getSms()">获取验证码</button>
|
<button class="code-btn" id="send-code" onclick="getSms()">获取验证码</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<button type="button" class="button button-primary" id="sms-button">
|
<button type="button" class="button button-primary" id="sms-button" onclick="bindToLogin()">
|
||||||
<!-- <i class="fas fa-user-plus mr-2"></i> -->
|
<!-- <i class="fas fa-user-plus mr-2"></i> -->
|
||||||
绑定
|
绑定
|
||||||
</button>
|
</button>
|
||||||
@@ -2121,6 +2392,7 @@
|
|||||||
|
|
||||||
|
|
||||||
function getSessionList() {
|
function getSessionList() {
|
||||||
|
console.log(userId, "huoqu")
|
||||||
|
|
||||||
sendParam.userId = userId;
|
sendParam.userId = userId;
|
||||||
fetch(`/api/sessions?userId=${sendParam.userId}`, {
|
fetch(`/api/sessions?userId=${sendParam.userId}`, {
|
||||||
|
|||||||
@@ -155,6 +155,7 @@ app.post('/wechat', async (req, res) => {
|
|||||||
|
|
||||||
if (key === 'AI_INTELLIGENT') {
|
if (key === 'AI_INTELLIGENT') {
|
||||||
try {
|
try {
|
||||||
|
const timestamp = Date.now();
|
||||||
// 方案一:简单文本回复(推荐,避免超时)
|
// 方案一:简单文本回复(推荐,避免超时)
|
||||||
const reply = `
|
const reply = `
|
||||||
<xml>
|
<xml>
|
||||||
@@ -162,7 +163,7 @@ app.post('/wechat', async (req, res) => {
|
|||||||
<FromUserName><![CDATA[${toUser}]]></FromUserName>
|
<FromUserName><![CDATA[${toUser}]]></FromUserName>
|
||||||
<CreateTime>${Date.now()}</CreateTime>
|
<CreateTime>${Date.now()}</CreateTime>
|
||||||
<MsgType><![CDATA[text]]></MsgType>
|
<MsgType><![CDATA[text]]></MsgType>
|
||||||
<Content><![CDATA[欢迎使用AI智能体!正在为您准备服务...<a href="https://ai.satabot.com?userId=${fromUser}&from=weixin" target="_blank">立即进入AI智能体</a>]]></Content>
|
<Content><![CDATA[欢迎使用AI智能体!正在为您准备服务...<a href="https://ai.satabot.com?userId=${fromUser}&from=weixin&ts=${timestamp}" target="_blank">立即进入AI智能体</a>]]></Content>
|
||||||
</xml>
|
</xml>
|
||||||
`;
|
`;
|
||||||
res.send(reply);
|
res.send(reply);
|
||||||
|
|||||||
Reference in New Issue
Block a user