fix: 排行榜昵称与管事/组长统计字段对齐
管事/组长不再展示 openid,改读业务昵称;俱乐部榜补充无效/有效邀请与收益字段;管事按有效人数、组长按收益总额排序。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -47,7 +47,7 @@ OPEN_RIQI_PERIOD_MAP = {
|
||||
DEFAULT_SORT_FIELD = {
|
||||
'dashou': 'chengjiao_zongliang',
|
||||
'guanshi': 'chongzhi_dashou_shu',
|
||||
'zuzhang': 'yaoqing_guanshi_shu',
|
||||
'zuzhang': 'shouru_zonge',
|
||||
'shangjia': 'jiesuan_jine',
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ SORT_FIELD_LABELS = {
|
||||
'chengjiao_zonge': '成交总额',
|
||||
'jiedan_zongliang': '接单量',
|
||||
'jiedan_zonge': '接单总额',
|
||||
'chongzhi_dashou_shu': '有效打手数',
|
||||
'chongzhi_dashou_shu': '有效人数',
|
||||
'shouru_zonge': '收益总额',
|
||||
'yaoqing_dashou_shu': '邀请打手数',
|
||||
'yaoqing_guanshi_shu': '邀请管事数',
|
||||
@@ -388,14 +388,14 @@ def _enrich_today_profiles(shenfen: str, yonghuids: list) -> dict:
|
||||
'CompletedAmount': 'jinrishouyi',
|
||||
}),
|
||||
'guanshi': (UserGuanshi, {
|
||||
'InvitedPlayerCount': None,
|
||||
'InvitedPlayerCount': 'yaogingshuliang',
|
||||
'RechargedPlayerCount': 'jinrichongzhi',
|
||||
'TotalIncome': None,
|
||||
'TotalIncome': 'chongzhifenrun',
|
||||
}),
|
||||
'zuzhang': (UserZuzhang, {
|
||||
'InvitedManagerCount': None,
|
||||
'InvitedManagerCount': 'yaoqing_zongshu',
|
||||
'CommissionAmount': 'jinri_fenyong',
|
||||
'TotalIncome': 'jinri_fenyong',
|
||||
'TotalIncome': 'fenyong_zonge',
|
||||
}),
|
||||
'shangjia': (UserShangjia, {
|
||||
'AssignedOrderCount': 'jinridingdan',
|
||||
@@ -443,6 +443,11 @@ def enrich_rank_stats(shenfen: str, yonghuids: list, riqi: str, club_id: str = '
|
||||
|
||||
result = {uid: {} for uid in yonghuids}
|
||||
|
||||
def _finish():
|
||||
from rank.display_utils import enrich_extra_rank_fields
|
||||
enrich_extra_rank_fields(shenfen, result, riqi)
|
||||
return result
|
||||
|
||||
def _fill_from_row(uid, row_data):
|
||||
for f in fields:
|
||||
key = response_field_map.get(f, f)
|
||||
@@ -458,11 +463,11 @@ def enrich_rank_stats(shenfen: str, yonghuids: list, riqi: str, club_id: str = '
|
||||
uid = r[id_field]
|
||||
if uid in result:
|
||||
_fill_from_row(uid, r)
|
||||
return result
|
||||
return _finish()
|
||||
|
||||
date_range = _resolve_date_range_for_display(riqi)
|
||||
if not date_range:
|
||||
return result
|
||||
return _finish()
|
||||
start_date, end_date = date_range
|
||||
|
||||
if start_date == end_date:
|
||||
@@ -474,10 +479,13 @@ def enrich_rank_stats(shenfen: str, yonghuids: list, riqi: str, club_id: str = '
|
||||
continue
|
||||
row_data = {f: getattr(r, f) for f in fields}
|
||||
_fill_from_row(uid, row_data)
|
||||
return result
|
||||
return _finish()
|
||||
if riqi == '今日':
|
||||
return _enrich_today_profiles(shenfen, yonghuids)
|
||||
return result
|
||||
today = _enrich_today_profiles(shenfen, yonghuids)
|
||||
for uid, row in today.items():
|
||||
result[uid] = {**result.get(uid, {}), **row}
|
||||
return _finish()
|
||||
return _finish()
|
||||
|
||||
rows = (
|
||||
model.objects.filter(Date__gte=start_date, Date__lte=end_date, **base_filter)
|
||||
@@ -488,7 +496,7 @@ def enrich_rank_stats(shenfen: str, yonghuids: list, riqi: str, club_id: str = '
|
||||
uid = r[id_field]
|
||||
if uid in result:
|
||||
_fill_from_row(uid, r)
|
||||
return result
|
||||
return _finish()
|
||||
|
||||
|
||||
def load_user_club_map(yonghuids: list) -> dict:
|
||||
|
||||
Reference in New Issue
Block a user