This commit is contained in:
HuangHai
2026-01-18 18:59:17 +08:00
parent 155d44ff4f
commit 6655e0cc29
26 changed files with 199 additions and 69 deletions

View File

@@ -15,7 +15,7 @@ if project_root not in sys.path:
import uiautomator2 as u2
from Apps.AiTeJiYiChong import Kit
from Apps.AiTeJiYiChong.Kit import take_screenshot, setup_logger
from Apps.AiTeJiYiChong.Kit import take_screenshot, setup_logger, get_name_md5
from Apps.AiTeJiYiChong.ReadImageKit import ReadImageKit
from Apps.AiTeJiYiChong.FirstPageKit import run_ocr_rect
from Util.RedisKit import RedisKit
@@ -177,7 +177,7 @@ async def get_station_list(d, service, max_stations_count=MAX_STATIONS_COUNT):
should_back_to_list = True
detail_uuid = f"detail_{station_name}_{image_uuid}"
detail_uuid = f"detail_{get_name_md5(station_name)}_{image_uuid}"
detail_path = take_screenshot(d, detail_uuid, save_dir=TEMP_IMAGE_DIR)
logger.info(f"已启动后台分析详情页: {station_name}")
@@ -268,7 +268,7 @@ async def get_station_list(d, service, max_stations_count=MAX_STATIONS_COUNT):
logger.info("正在从顶部开始向下逐页截图...")
max_scroll_down_pages = 10
for p_idx in range(1, max_scroll_down_pages + 1):
p_shot = take_screenshot(d, f"price_scroll_{p_idx}_{station_name}", save_dir=TEMP_IMAGE_DIR)
p_shot = take_screenshot(d, f"price_scroll_{p_idx}_{get_name_md5(station_name)}", save_dir=TEMP_IMAGE_DIR)
before_dn_md5 = Kit.get_image_content_md5(p_shot)
d.swipe_ext("up", scale=0.8)

View File

@@ -35,6 +35,13 @@ def get_file_md5(file_path):
hash_md5.update(chunk)
return hash_md5.hexdigest()
def get_name_md5(name):
if not name:
return "unknown"
if not isinstance(name, str):
name = str(name)
return hashlib.md5(name.encode("utf-8")).hexdigest()
def get_image_content_md5(file_path, top_ratio=0.1, bottom_ratio=0.1):
"""