This commit is contained in:
eric
2026-03-31 13:40:50 -05:00
parent 169c66e551
commit da08f91b4d

View File

@@ -509,6 +509,11 @@ async def nomadvip_wechat_profile(item: dict):
if user_id and not anonymous_user_id
else None
)
link_by_wechat_userid = (
_pb_find_email_link_by_anonymous_user_id(admin_token, wechat_userid)
if wechat_userid
else None
)
link_by_anonymous = (
_pb_find_email_link_by_anonymous_user_id(admin_token, anonymous_user_id)
if anonymous_user_id
@@ -517,21 +522,34 @@ async def nomadvip_wechat_profile(item: dict):
linked_email = (
(_record_get(link_by_email, "email", "") or "").strip().lower()
or (_record_get(link_by_user_id, "email", "") or "").strip().lower()
or (_record_get(link_by_wechat_userid, "email", "") or "").strip().lower()
or (_record_get(link_by_anonymous, "email", "") or "").strip().lower()
or email
)
linked_pb_user_id = (
(_record_get(link_by_email, "user_id", "") or "").strip()
or (_record_get(link_by_user_id, "user_id", "") or "").strip()
or (_record_get(link_by_wechat_userid, "user_id", "") or "").strip()
or (_record_get(link_by_anonymous, "user_id", "") or "").strip()
or pb_user_id
)
linked_anonymous_user_id = (
(_record_get(link_by_anonymous, "anonymous_user_id", "") or "").strip()
or (_record_get(link_by_wechat_userid, "anonymous_user_id", "") or "").strip()
or (_record_get(link_by_email, "anonymous_user_id", "") or "").strip()
or anonymous_user_id
)
has_vip_by_linked_user = False
if linked_pb_user_id and linked_pb_user_id != user_id:
try:
from ..services.pb import get_pb_client
pb = get_pb_client()
has_vip_by_linked_user = _uid_has_vip(pb, linked_pb_user_id)
except Exception:
has_vip_by_linked_user = False
profile_record = _pb_get_wechat_private_user(admin_token, wechat_userid) if wechat_userid else None
if not profile_record:
return {
@@ -548,6 +566,7 @@ async def nomadvip_wechat_profile(item: dict):
"has_vip_by_user_id": has_vip_by_user_id,
"has_vip_by_pb_user": has_vip_by_pb_user,
"has_vip_by_wechat_userid": has_vip_by_wechat_userid,
"has_vip_by_linked_user": has_vip_by_linked_user,
},
}
@@ -581,6 +600,7 @@ async def nomadvip_wechat_profile(item: dict):
"has_vip_by_user_id": has_vip_by_user_id,
"has_vip_by_pb_user": has_vip_by_pb_user,
"has_vip_by_wechat_userid": has_vip_by_wechat_userid,
"has_vip_by_linked_user": has_vip_by_linked_user,
},
}