From e07ac8040288ceb9f881a9370cbbdbdf2fef6da7 Mon Sep 17 00:00:00 2001 From: me <2336164407@qq.com> Date: Fri, 8 Aug 2025 19:47:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8C=87=E5=AE=9A=E5=95=86?= =?UTF-8?q?=E5=93=81=E5=9B=9E=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- XianyuAutoAsync.py | 6 ++++++ db_manager.py | 6 +++--- reply_server.py | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/XianyuAutoAsync.py b/XianyuAutoAsync.py index 09506c4..4b6fec6 100644 --- a/XianyuAutoAsync.py +++ b/XianyuAutoAsync.py @@ -1060,12 +1060,18 @@ class XianyuLive: # 进行变量替换 try: + # 获取当前商品是否有设置自动回复 + item_replay = db_manager.get_item_replay(item_id) + formatted_reply = reply_content.format( send_user_name=send_user_name, send_user_id=send_user_id, send_message=send_message ) + if item_replay: + formatted_reply = item_replay.get('reply_content', '') + # 如果开启了"只回复一次"功能,记录这次回复 if default_reply_settings.get('reply_once', False) and chat_id: db_manager.add_default_reply_record(self.cookie_id, chat_id) diff --git a/db_manager.py b/db_manager.py index 593624b..002f07d 100644 --- a/db_manager.py +++ b/db_manager.py @@ -318,12 +318,12 @@ class DBManager: # 创建指定商品回复表 cursor.execute(''' CREATE TABLE IF NOT EXISTS item_replay ( - item_id TEXT NOT NULL PRIMARY KEY, + id INTEGER PRIMARY KEY AUTOINCREMENT, + item_id TEXT NOT NULL, cookie_id TEXT NOT NULL, reply_content TEXT NOT NULL , created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - FOREIGN KEY (item_id) REFERENCES cookies(id) ON DELETE CASCADE + updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ) ''') diff --git a/reply_server.py b/reply_server.py index 8895cad..b6c3a9a 100644 --- a/reply_server.py +++ b/reply_server.py @@ -3851,7 +3851,7 @@ def delete_table_record(table_name: str, record_id: str, admin_user: Dict[str, A 'users', 'cookies', 'cookie_status', 'keywords', 'default_replies', 'default_reply_records', 'ai_reply_settings', 'ai_conversations', 'ai_item_cache', 'item_info', 'message_notifications', 'cards', 'delivery_rules', 'notification_channels', - 'user_settings', 'system_settings', 'email_verifications', 'captcha_codes', 'orders' + 'user_settings', 'system_settings', 'email_verifications', 'captcha_codes', 'orders','item_replay' ] if table_name not in allowed_tables: