diff --git a/XianyuAutoAsync.py b/XianyuAutoAsync.py index ecb4a78..6602eef 100644 --- a/XianyuAutoAsync.py +++ b/XianyuAutoAsync.py @@ -173,7 +173,7 @@ class XianyuLive: # 通知防重复机制 self.last_notification_time = {} # 记录每种通知类型的最后发送时间 self.notification_cooldown = 300 # 5分钟内不重复发送相同类型的通知 - self.token_refresh_notification_cooldown = 10800 # Token刷新异常通知冷却时间:3小时 + self.token_refresh_notification_cooldown = 18000 # Token刷新异常通知冷却时间:3小时 # 自动发货防重复机制 self.last_delivery_time = {} # 记录每个商品的最后发货时间 diff --git a/db_manager.py b/db_manager.py index aef1a13..68d50d9 100644 --- a/db_manager.py +++ b/db_manager.py @@ -277,6 +277,15 @@ class DBManager: ) ''') + # 检查并添加 multi_quantity_delivery 列(用于多数量发货功能) + try: + self._execute_sql(cursor, "SELECT multi_quantity_delivery FROM item_info LIMIT 1") + except sqlite3.OperationalError: + # multi_quantity_delivery 列不存在,需要添加 + logger.info("正在为 item_info 表添加 multi_quantity_delivery 列...") + self._execute_sql(cursor, "ALTER TABLE item_info ADD COLUMN multi_quantity_delivery BOOLEAN DEFAULT FALSE") + logger.info("item_info 表 multi_quantity_delivery 列添加完成") + # 创建自动发货规则表 cursor.execute(''' CREATE TABLE IF NOT EXISTS delivery_rules ( diff --git a/global_config.yml b/global_config.yml index 8df93ae..f8bd39b 100644 --- a/global_config.yml +++ b/global_config.yml @@ -58,7 +58,7 @@ MANUAL_MODE: timeout: 3600 toggle_keywords: [] MESSAGE_EXPIRE_TIME: 300000 -TOKEN_REFRESH_INTERVAL: 7200 # 从3600秒(1小时)增加到7200秒(2小时) +TOKEN_REFRESH_INTERVAL: 18000 # 从3600秒(1小时)增加到18000秒(5小时) TOKEN_RETRY_INTERVAL: 1800 # 从300秒(5分钟)增加到1800秒(30分钟) WEBSOCKET_HEADERS: Accept-Encoding: gzip, deflate, br, zstd diff --git a/utils/order_detail_fetcher.py b/utils/order_detail_fetcher.py index 940a91b..dc56fff 100644 --- a/utils/order_detail_fetcher.py +++ b/utils/order_detail_fetcher.py @@ -445,10 +445,16 @@ class OrderDetailFetcher: # 从数量内容中提取数量值(使用冒号分割,取后面的值) if ':' in quantity_content: quantity_value = quantity_content.split(':', 1)[1].strip() + # 去掉数量值前面的 'x' 符号(如 "x2" -> "2") + if quantity_value.startswith('x'): + quantity_value = quantity_value[1:] result['quantity'] = quantity_value logger.info(f"提取到数量: {quantity_value}") print(f"🔢 数量: {quantity_value}") else: + # 去掉数量值前面的 'x' 符号(如 "x2" -> "2") + if quantity_content.startswith('x'): + quantity_content = quantity_content[1:] result['quantity'] = quantity_content logger.info(f"数量内容无冒号,直接使用: {quantity_content}") print(f"🔢 数量: {quantity_content}") @@ -471,10 +477,16 @@ class OrderDetailFetcher: if ':' in content: quantity_value = content.split(':', 1)[1].strip() + # 去掉数量值前面的 'x' 符号(如 "x2" -> "2") + if quantity_value.startswith('x'): + quantity_value = quantity_value[1:] result['quantity'] = quantity_value logger.info(f"提取到数量: {quantity_value}") print(f"🔢 数量: {quantity_value}") else: + # 去掉数量值前面的 'x' 符号(如 "x2" -> "2") + if content.startswith('x'): + content = content[1:] result['quantity'] = content logger.info(f"数量内容无冒号,直接使用: {content}") print(f"🔢 数量: {content}")