feat: 组队大厅返回商家UID/头像与队长头像
serialize_recruit_public 对齐抢单池补 shangjia_id、sj_avatar、leader_avatar。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -654,7 +654,10 @@ def serialize_recruit_public(rec, order=None, *, include_game_ids=False) -> dict
|
|||||||
'jieshao': (order.Description or '') if order else '',
|
'jieshao': (order.Description or '') if order else '',
|
||||||
'tupian': (order.ImageURL or '') if order else '',
|
'tupian': (order.ImageURL or '') if order else '',
|
||||||
'order_zhuangtai': getattr(order, 'Status', None) if order else None,
|
'order_zhuangtai': getattr(order, 'Status', None) if order else None,
|
||||||
|
'shangjia_id': '',
|
||||||
'shangjia_nicheng': '',
|
'shangjia_nicheng': '',
|
||||||
|
'sj_avatar': '',
|
||||||
|
'leader_avatar': '',
|
||||||
'leader_deal_stat': None,
|
'leader_deal_stat': None,
|
||||||
}
|
}
|
||||||
if order:
|
if order:
|
||||||
@@ -662,7 +665,24 @@ def serialize_recruit_public(rec, order=None, *, include_game_ids=False) -> dict
|
|||||||
if order.Platform == 2:
|
if order.Platform == 2:
|
||||||
try:
|
try:
|
||||||
ext = order.shangjia_kuozhan
|
ext = order.shangjia_kuozhan
|
||||||
|
sj_uid = (ext.MerchantID or '').strip()
|
||||||
|
data['shangjia_id'] = sj_uid
|
||||||
data['shangjia_nicheng'] = ext.MerchantNickname or ''
|
data['shangjia_nicheng'] = ext.MerchantNickname or ''
|
||||||
|
# 对齐抢单池:商家头像取 User.Avatar
|
||||||
|
if sj_uid:
|
||||||
|
try:
|
||||||
|
sj_user = User.query.filter(UserUID=sj_uid).first()
|
||||||
|
if sj_user:
|
||||||
|
data['sj_avatar'] = getattr(sj_user, 'Avatar', None) or ''
|
||||||
|
if not data['shangjia_nicheng']:
|
||||||
|
try:
|
||||||
|
boss = getattr(sj_user, 'BossProfile', None)
|
||||||
|
if boss and getattr(boss, 'nickname', None):
|
||||||
|
data['shangjia_nicheng'] = boss.nickname
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
# 自动结算字段:仅锁定且订单结算中
|
# 自动结算字段:仅锁定且订单结算中
|
||||||
@@ -671,8 +691,10 @@ def serialize_recruit_public(rec, order=None, *, include_game_ids=False) -> dict
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
u = User.query.filter(UserUID=rec.leader_uid).select_related('DashouProfile').first()
|
u = User.query.filter(UserUID=rec.leader_uid).select_related('DashouProfile').first()
|
||||||
if u and getattr(u, 'DashouProfile', None):
|
if u:
|
||||||
data['leader_nicheng'] = u.DashouProfile.nicheng or ''
|
data['leader_avatar'] = getattr(u, 'Avatar', None) or ''
|
||||||
|
if getattr(u, 'DashouProfile', None):
|
||||||
|
data['leader_nicheng'] = u.DashouProfile.nicheng or ''
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user