From 78c8b3b69eb4acce21ea0aa18655f71b7c1feb2e Mon Sep 17 00:00:00 2001
From: chenyc <501753378@qq.com>
Date: 星期一, 04 十一月 2024 15:00:48 +0800
Subject: [PATCH] 更新回传结果接口
---
app.js | 35 +++++++++++++++++++++++++----------
1 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/app.js b/app.js
index 143f9dc..842edb6 100644
--- a/app.js
+++ b/app.js
@@ -46,16 +46,28 @@
config.endpoint = `facebody.cn-shanghai.aliyuncs.com`;
return new facebody20191230.default(config);
}
-app.get('/',async(req,res)=>{
- const filePath = path.join(__dirname, 'public', 'index.html');
- fs2.readFile(filePath, 'utf8', (err, data) => {
- if (err) {
- res.status(500).send('Error reading file');
- return;
- }
- res.send(data);
- });
-})
+app.get('/', (req, res) => {
+ const title = '岱特智能'; // 动态设置标题
+ const html = `
+ <!DOCTYPE html>
+ <html lang="zh-CN">
+ <head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>${title}</title>
+ </head>
+ <body>
+ <iframe
+ src="https://udify.app/chatbot/irsmISE8DBCWAhxz"
+ style="width: 100%; height: 100%; min-height: 700px"
+ frameborder="0"
+ allow="microphone">
+ </iframe>
+ </body>
+ </html>
+ `;
+ res.send(html);
+ });
// 定义 /webuser 路由处理器 用患者code 换信息
app.post('/webuser', async (req, res) => {
const mode=req.body
@@ -200,7 +212,9 @@
const action = req.body.action;
const deviceID = req.body.deviceID;
const mode=req.body
+ mode.action='webResults'
logHttps(mode)
+ console.log('----------')
try {
const datas=mode.datas
datas.forEach(async element => {
@@ -348,6 +362,7 @@
const logHttps=(mode)=>{
try{
let sqlStr=`INSERT INTO system_log (id, code, url, parameter) VALUES (0, '', '${mode.action}', '${JSON.stringify(mode)}')`
+ console.log(sqlStr)
pool.promise().query(sqlStr)
}catch (err) {
console.error('访问日志记录错误:', err);
--
Gitblit v1.8.0