修复指定商品回复

修复指定商品回复
This commit is contained in:
zhinianboke 2025-08-12 08:53:08 +08:00 committed by GitHub
commit 3cb37a8240
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 4 deletions

View File

@ -1245,12 +1245,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)

View File

@ -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
)
''')

View File

@ -3952,7 +3952,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: