feat: 增强福袋详情记录功能,优化映射表记录逻辑,修复重复标题处理
This commit is contained in:
1 parent
716567dbb0
commit
55a3f3a0af
5 files changed
+64
-101
No files matched your search
@@ -5,8 +5,10 @@
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
sys.path.insert(0, os.path.dirname(__file__))
|
||||
|
||||
|
||||
def validate_fudai_mapping_recording():
|
||||
"""验证福袋详情识别完成后映射表记录功能"""
|
||||
print("开始验证福袋详情识别完成后映射表记录功能...")
|
||||
@@ -14,17 +16,15 @@ def validate_fudai_mapping_recording():
|
||||
# 检查代码模式
|
||||
patterns_to_check = [
|
||||
"analyser._current_fudai_content = content",
|
||||
"analyser._last_fudai_detail_tuple = detail_tuple",
|
||||
"douyin_reservation_handler.ReservationHandler.record_room_title_and_pos",
|
||||
"_record_mapping_async",
|
||||
"启动映射表记录",
|
||||
"映射表记录完成"
|
||||
"analyser._last_fudai_detail_tuple = detail",
|
||||
"basic_join_decision:设置福袋信息并记录映射表",
|
||||
"_record_room_title_and_pos"
|
||||
]
|
||||
|
||||
# 读取文件内容
|
||||
file_path = "fudai_detail_modules/fudai_detail_reader.py"
|
||||
file_path = "douyin/fudai/douyin_fudai_core.py"
|
||||
try:
|
||||
with open(file_path, 'r', encoding='utf-8') as f:
|
||||
with open(file_path, "r", encoding="utf-8") as f:
|
||||
content = f.read()
|
||||
except Exception as e:
|
||||
print(f"❌ 无法读取文件 {file_path}: {e}")
|
||||
@@ -42,25 +42,14 @@ def validate_fudai_mapping_recording():
|
||||
print(f" - {pattern}")
|
||||
return False
|
||||
|
||||
# 检查映射表记录的位置(应该在函数结尾)
|
||||
return_pos = content.find('return "ok", detail_tuple, extra')
|
||||
mapping_start = content.find('在福袋详情识别完成后记录映射表')
|
||||
|
||||
if return_pos == -1 or mapping_start == -1:
|
||||
print("❌ 无法找到返回语句或映射表记录代码")
|
||||
return False
|
||||
|
||||
if mapping_start >= return_pos:
|
||||
print("❌ 映射表记录代码应该在返回语句之前")
|
||||
return False
|
||||
|
||||
print("✅ 福袋详情识别完成后映射表记录功能验证通过")
|
||||
print(" - 福袋属性设置代码存在")
|
||||
print(" - 映射表记录调用存在")
|
||||
print(" - 记录时机正确(在识别完成后)")
|
||||
print(" - 记录时机正确(在basic_join_decision开始时)")
|
||||
|
||||
return True
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
success = validate_fudai_mapping_recording()
|
||||
sys.exit(0 if success else 1)
|
||||
sys.exit(0 if success else 1)
|
||||
Reference in new issue
Block a user