fix(messages): 微信图片type=2映射漏掉(存成unknown前端不渲染)——补image映射+存量回填49504行
真机A**杰对话发现:新版云客图片走type=2且fileTh带完整OSS URL(旧映射只认 3=image_legacy)。存量回填:type_raw=2→image(49504行,其中47126带URL可渲染/ 本地化)。A**杰对话实测图片正常显示(OSS直连渲染,本地化批后台进行中) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -885,11 +885,23 @@ async def scrape_group_messages(cookie_str: str, max_groups: int = 500):
|
|||||||
|
|
||||||
|
|
||||||
def _normalize_msg_type(raw_type) -> str | None:
|
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:
|
if raw_type is None:
|
||||||
return None
|
return None
|
||||||
t = str(raw_type)
|
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")
|
return mapping.get(t, "unknown")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user