backup
This commit is contained in:
@@ -249,7 +249,7 @@ app.get('/api/rooms/:roomId/purchases/export', auth, (req, res) => {
|
|||||||
// WebSocket
|
// WebSocket
|
||||||
const clients = new Map();
|
const clients = new Map();
|
||||||
wss.on('connection', (ws, req) => {
|
wss.on('connection', (ws, req) => {
|
||||||
console.log('✅ WebSocket 客户端已连接');
|
//console.log('✅ WebSocket 客户端已连接');
|
||||||
const url = new URL(req.url, 'http://localhost');
|
const url = new URL(req.url, 'http://localhost');
|
||||||
const token = url.searchParams.get('token');
|
const token = url.searchParams.get('token');
|
||||||
if (!token) return ws.close();
|
if (!token) return ws.close();
|
||||||
@@ -516,11 +516,12 @@ function handleAIResult(aiResult, roomId, username, originalText, attachments) {
|
|||||||
console.log('📎 插入附件:', attachments.length, '个, purchase_id=', purchase.id);
|
console.log('📎 插入附件:', attachments.length, '个, purchase_id=', purchase.id);
|
||||||
const insertAttach = db.prepare('INSERT INTO purchase_attachments (purchase_id, file_path, uploaded_by, timestamp) VALUES (?,?,?,?)');
|
const insertAttach = db.prepare('INSERT INTO purchase_attachments (purchase_id, file_path, uploaded_by, timestamp) VALUES (?,?,?,?)');
|
||||||
attachments.forEach(fp => { console.log(' 📎', fp); insertAttach.run(purchase.id, fp, username, now); });
|
attachments.forEach(fp => { console.log(' 📎', fp); insertAttach.run(purchase.id, fp, username, now); });
|
||||||
if (usedRecentImage) {
|
|
||||||
replyText = `📎 已为「${aiResult.purchase_item}」关联 ${attachments.length} 个附件`;
|
|
||||||
db.prepare('INSERT INTO purchase_history (purchase_id, action, user, timestamp) VALUES (?,?,?,?)').run(purchase.id, `添加附件:${attachments.length} 个`, username, now);
|
db.prepare('INSERT INTO purchase_history (purchase_id, action, user, timestamp) VALUES (?,?,?,?)').run(purchase.id, `添加附件:${attachments.length} 个`, username, now);
|
||||||
console.log('✅ usedRecentImage 完成, replyText:', replyText);
|
// 如果字段没有变化,覆盖回复消息
|
||||||
|
if (replyText.includes('没有发生') || usedRecentImage) {
|
||||||
|
replyText = `📎 已为「${aiResult.purchase_item}」添加 ${attachments.length} 个附件`;
|
||||||
}
|
}
|
||||||
|
console.log('✅ 附件完成, replyText:', replyText);
|
||||||
} else if (usedRecentImage) {
|
} else if (usedRecentImage) {
|
||||||
replyText = `❌ 未找到最近的图片消息,请先发送图片再试。`;
|
replyText = `❌ 未找到最近的图片消息,请先发送图片再试。`;
|
||||||
console.log('⚠️ usedRecentImage 但附件为空');
|
console.log('⚠️ usedRecentImage 但附件为空');
|
||||||
|
|||||||
Reference in New Issue
Block a user