From ad0bfeba16d3831436e84a6b8feed97e8ad7122d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=85=E5=BF=B5?= Date: Thu, 20 Aug 2026 15:16:26 +0800 Subject: [PATCH] =?UTF-8?q?fix(messages):=20=E5=BE=AE=E4=BF=A1=E5=9B=BE?= =?UTF-8?q?=E7=89=87type=3D2=E6=98=A0=E5=B0=84=E6=BC=8F=E6=8E=89(=E5=AD=98?= =?UTF-8?q?=E6=88=90unknown=E5=89=8D=E7=AB=AF=E4=B8=8D=E6=B8=B2=E6=9F=93)?= =?UTF-8?q?=E2=80=94=E2=80=94=E8=A1=A5image=E6=98=A0=E5=B0=84+=E5=AD=98?= =?UTF-8?q?=E9=87=8F=E5=9B=9E=E5=A1=AB49504=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 真机A**杰对话发现:新版云客图片走type=2且fileTh带完整OSS URL(旧映射只认 3=image_legacy)。存量回填:type_raw=2→image(49504行,其中47126带URL可渲染/ 本地化)。A**杰对话实测图片正常显示(OSS直连渲染,本地化批后台进行中) Co-Authored-By: Claude --- yunke-server/scripts/scrape_via_page.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/yunke-server/scripts/scrape_via_page.py b/yunke-server/scripts/scrape_via_page.py index bb8acc0..10cd8a4 100644 --- a/yunke-server/scripts/scrape_via_page.py +++ b/yunke-server/scripts/scrape_via_page.py @@ -885,11 +885,23 @@ async def scrape_group_messages(cookie_str: str, max_groups: int = 500): def _normalize_msg_type(raw_type) -> str | None: - """Normalize a raw message type to our canonical type string.""" + """Normalize a raw message type to our canonical type string. + + 微信 type=2 = 图片(新版,fileTh 带完整 OSS URL;真机 A**杰对话确认 + 2026-08-20——旧映射漏掉它导致图片被存成 unknown 前端不渲染)。 + """ if raw_type is None: return None t = str(raw_type) - mapping = {"1": "text", "3": "image_legacy", "34": "voice", "43": "video", "47": "emoji", "49": "file"} + mapping = { + "1": "text", + "2": "image", # 新版图片(fileTh URL) + "3": "image_legacy", # 旧版图片(md5/键) + "34": "voice", + "43": "video", + "47": "emoji", + "49": "file", + } return mapping.get(t, "unknown")