mirror of
https://github.com/zhinianboke/xianyu-auto-reply.git
synced 2025-08-29 17:17:38 +08:00
新增自动免拼
This commit is contained in:
parent
b212d4d9fb
commit
4b25f3f924
16
.env
16
.env
@ -170,6 +170,22 @@ MEMORY_LIMIT=512
|
||||
# CPU限制 (核心数)
|
||||
CPU_LIMIT=0.5
|
||||
|
||||
# 内存预留 (MB)
|
||||
MEMORY_RESERVATION=256
|
||||
|
||||
# CPU预留 (核心数)
|
||||
CPU_RESERVATION=0.25
|
||||
|
||||
# ================================
|
||||
# SQL日志配置
|
||||
# ================================
|
||||
|
||||
# 是否启用SQL日志
|
||||
SQL_LOG_ENABLED=true
|
||||
|
||||
# SQL日志级别
|
||||
SQL_LOG_LEVEL=INFO
|
||||
|
||||
# ================================
|
||||
# 备份配置
|
||||
# ================================
|
||||
|
@ -3,8 +3,8 @@ FROM python:3.11-slim
|
||||
|
||||
# 设置标签信息
|
||||
LABEL maintainer="zhinianboke"
|
||||
LABEL version="2.0.0"
|
||||
LABEL description="闲鱼自动回复系统 - 企业级多用户版本"
|
||||
LABEL version="2.1.0"
|
||||
LABEL description="闲鱼自动回复系统 - 企业级多用户版本,支持自动发货和免拼发货"
|
||||
LABEL repository="https://github.com/zhinianboke/xianyu-auto-reply"
|
||||
LABEL license="仅供学习使用,禁止商业用途"
|
||||
LABEL author="zhinianboke"
|
||||
|
@ -88,7 +88,8 @@ xianyu-auto-reply/
|
||||
│ ├── ai_reply_engine.py # AI智能回复引擎,支持多种AI模型
|
||||
│ ├── file_log_collector.py # 实时日志收集和管理系统
|
||||
│ ├── config.py # 全局配置文件管理器
|
||||
│ └── secure_confirm_ultra.py # 自动确认发货模块(多层加密保护)
|
||||
│ ├── secure_confirm_ultra.py # 自动确认发货模块(多层加密保护)
|
||||
│ └── secure_freeshipping_ultra.py # 自动免拼发货模块(多层加密保护)
|
||||
├── 🛠️ 工具模块
|
||||
│ └── utils/
|
||||
│ ├── xianyu_utils.py # 闲鱼API工具函数(加密、签名、解析)
|
||||
@ -116,6 +117,7 @@ xianyu-auto-reply/
|
||||
├── 📋 配置文件
|
||||
│ ├── global_config.yml # 全局配置文件(WebSocket、API等)
|
||||
│ ├── requirements.txt # Python依赖包列表
|
||||
│ ├── .env # 环境变量配置文件
|
||||
│ └── README.md # 项目说明文档
|
||||
└── 📊 数据目录
|
||||
├── xianyu_data.db # SQLite数据库文件
|
||||
|
@ -1506,6 +1506,30 @@ class XianyuLive:
|
||||
logger.error(f"【{self.cookie_id}】加密确认模块调用失败: {self._safe_str(e)}")
|
||||
return {"error": f"加密确认模块调用失败: {self._safe_str(e)}", "order_id": order_id}
|
||||
|
||||
async def auto_freeshipping(self, order_id, item_id, buyer_id, retry_count=0):
|
||||
"""自动免拼发货 - 使用加密模块"""
|
||||
try:
|
||||
logger.debug(f"【{self.cookie_id}】开始免拼发货,订单ID: {order_id}")
|
||||
|
||||
# 导入超级混淆加密模块
|
||||
from secure_freeshipping_ultra import SecureFreeshipping
|
||||
|
||||
# 创建加密免拼发货实例
|
||||
secure_freeshipping = SecureFreeshipping(self.session, self.cookies_str, self.cookie_id)
|
||||
|
||||
# 传递必要的属性
|
||||
secure_freeshipping.current_token = self.current_token
|
||||
secure_freeshipping.last_token_refresh_time = self.last_token_refresh_time
|
||||
secure_freeshipping.token_refresh_interval = self.token_refresh_interval
|
||||
secure_freeshipping.refresh_token = self.refresh_token # 传递refresh_token方法
|
||||
|
||||
# 调用加密的免拼发货方法
|
||||
return await secure_freeshipping.auto_freeshipping(order_id, item_id, buyer_id, retry_count)
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"【{self.cookie_id}】加密免拼发货模块调用失败: {self._safe_str(e)}")
|
||||
return {"error": f"加密免拼发货模块调用失败: {self._safe_str(e)}", "order_id": order_id}
|
||||
|
||||
async def fetch_order_detail_info(self, order_id: str):
|
||||
"""获取订单详情信息"""
|
||||
try:
|
||||
@ -2576,10 +2600,24 @@ class XianyuLive:
|
||||
|
||||
# 检查是否为"我已小刀,待刀成"
|
||||
if card_title == "我已小刀,待刀成":
|
||||
logger.info(f'[{msg_time}] 【{self.cookie_id}】【系统】检测到"我已小刀,待刀成",准备自动发货')
|
||||
# 使用统一的自动发货处理方法
|
||||
await self._handle_auto_delivery(websocket, message, send_user_name, send_user_id,
|
||||
item_id, chat_id, msg_time)
|
||||
logger.info(f'[{msg_time}] 【{self.cookie_id}】【系统】检测到"我已小刀,待刀成",准备自动免拼发货')
|
||||
# 提取订单ID
|
||||
order_id = self._extract_order_id(message)
|
||||
if order_id:
|
||||
# 延迟2秒后执行免拼发货
|
||||
logger.info(f'[{msg_time}] 【{self.cookie_id}】延迟2秒后执行免拼发货...')
|
||||
await asyncio.sleep(2)
|
||||
# 调用自动免拼发货方法
|
||||
result = await self.auto_freeshipping(order_id, item_id, send_user_id)
|
||||
if result.get('success'):
|
||||
logger.info(f'[{msg_time}] 【{self.cookie_id}】✅ 自动免拼发货成功')
|
||||
else:
|
||||
logger.warning(f'[{msg_time}] 【{self.cookie_id}】❌ 自动免拼发货失败: {result.get("error", "未知错误")}')
|
||||
await self._handle_auto_delivery(websocket, message, send_user_name, send_user_id,
|
||||
item_id, chat_id, msg_time)
|
||||
return
|
||||
else:
|
||||
logger.warning(f'[{msg_time}] 【{self.cookie_id}】❌ 未能提取到订单ID,无法执行免拼发货')
|
||||
return
|
||||
else:
|
||||
logger.info(f'[{msg_time}] 【{self.cookie_id}】收到卡片消息,标题: {card_title or "未知"}')
|
||||
|
@ -98,6 +98,7 @@ typing-extensions>=4.7.0
|
||||
# - copy (对象复制)
|
||||
# - pickle (对象序列化)
|
||||
# - gzip (压缩)
|
||||
# - zlib (数据压缩)
|
||||
# - zipfile (ZIP文件)
|
||||
# - tarfile (TAR文件)
|
||||
# - shutil (文件操作)
|
||||
|
43
secure_freeshipping_ultra.py
Normal file
43
secure_freeshipping_ultra.py
Normal file
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user