feat(scraper): map customer add_time from raw_json
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -248,6 +248,13 @@ def _normalize_whatsapp_friend(record: dict[str, Any]) -> dict[str, Any]:
|
||||
and the per-contact counts ``groupNum`` / ``contactsNum`` / ``talkerCount``
|
||||
/ ``friendAddNum`` / ``sensitiveWordNum`` survive end-to-end even though
|
||||
they have no direct ``Customer`` column). ``None``-safe on every field.
|
||||
|
||||
``add_time`` is deliberately ``None``: the WhatsApp ``businessFriendList``
|
||||
payload carries no customer-side add-time field (the ``createTime`` field
|
||||
on this record is the **owner-staff** account's createTime, not the
|
||||
contact's — confirmed via smoke.db raw_json dump). Mapping it to
|
||||
``createTime`` would be semantically wrong; the column stays NULL for WA
|
||||
contacts (the wechat channel carries the truthful ``addTime``).
|
||||
"""
|
||||
return {
|
||||
"friend_id": record.get("friendUid"),
|
||||
@@ -259,6 +266,8 @@ def _normalize_whatsapp_friend(record: dict[str, Any]) -> dict[str, Any]:
|
||||
"user_id": record.get("userId"),
|
||||
"message_count": record.get("messageCount"),
|
||||
"last_chat_time": parse_datetime_to_ms(record.get("lastUpdate"), _WA_DATETIME_FORMATS),
|
||||
# No customer-side add-time on this payload (see docstring); left NULL.
|
||||
"add_time": None,
|
||||
"version": record.get("version"),
|
||||
"raw_json": record,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user