修正过早的键更新
This commit is contained in:
@@ -34,6 +34,12 @@ ROLE_CONFIG = {
|
||||
'sort_field': 'CompletedAmount',
|
||||
'fields': ('AcceptedOrderTotal', 'CompletedOrderTotal', 'AcceptedAmount', 'CompletedAmount'),
|
||||
'int_fields': frozenset({'AcceptedOrderTotal', 'CompletedOrderTotal'}),
|
||||
'response_field_map': {
|
||||
'AcceptedOrderTotal': 'jiedan_zongliang',
|
||||
'CompletedOrderTotal': 'chengjiao_zongliang',
|
||||
'AcceptedAmount': 'jiedan_zonge',
|
||||
'CompletedAmount': 'chengjiao_zonge',
|
||||
},
|
||||
},
|
||||
'guanshi': {
|
||||
'model': ManagerDailyStats,
|
||||
@@ -41,6 +47,11 @@ ROLE_CONFIG = {
|
||||
'sort_field': 'TotalIncome',
|
||||
'fields': ('InvitedPlayerCount', 'RechargedPlayerCount', 'TotalIncome'),
|
||||
'int_fields': frozenset({'InvitedPlayerCount', 'RechargedPlayerCount'}),
|
||||
'response_field_map': {
|
||||
'InvitedPlayerCount': 'yaoqing_dashou_shu',
|
||||
'RechargedPlayerCount': 'chongzhi_dashou_shu',
|
||||
'TotalIncome': 'shouru_zonge',
|
||||
},
|
||||
},
|
||||
'zuzhang': {
|
||||
'model': LeaderDailyStats,
|
||||
@@ -48,6 +59,11 @@ ROLE_CONFIG = {
|
||||
'sort_field': 'TotalIncome',
|
||||
'fields': ('InvitedManagerCount', 'CommissionAmount', 'TotalIncome'),
|
||||
'int_fields': frozenset({'InvitedManagerCount'}),
|
||||
'response_field_map': {
|
||||
'InvitedManagerCount': 'yaoqing_guanshi_shu',
|
||||
'CommissionAmount': 'fenyong_jine',
|
||||
'TotalIncome': 'shouru_zonge',
|
||||
},
|
||||
},
|
||||
'shangjia': {
|
||||
'model': MerchantDailyStats,
|
||||
@@ -55,6 +71,12 @@ ROLE_CONFIG = {
|
||||
'sort_field': 'SettledAmount',
|
||||
'fields': ('AssignedOrderCount', 'AssignedAmount', 'SettledOrderCount', 'SettledAmount'),
|
||||
'int_fields': frozenset({'AssignedOrderCount', 'SettledOrderCount'}),
|
||||
'response_field_map': {
|
||||
'AssignedOrderCount': 'paifa_dingdan_shu',
|
||||
'AssignedAmount': 'paifa_jine',
|
||||
'SettledOrderCount': 'jiesuan_dingdan_shu',
|
||||
'SettledAmount': 'jiesuan_jine',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -186,6 +208,7 @@ class PhbHqsjView(APIView):
|
||||
id_field = cfg['id_field']
|
||||
|
||||
result_list = []
|
||||
response_field_map = cfg.get('response_field_map', {})
|
||||
for idx, row in enumerate(rows):
|
||||
yonghuid = row[id_field]
|
||||
item = {
|
||||
@@ -195,7 +218,8 @@ class PhbHqsjView(APIView):
|
||||
'touxiang': avatar_map.get(yonghuid, '') or '',
|
||||
}
|
||||
for field in cfg['fields']:
|
||||
item[field] = _fmt_value(row.get(field), field in int_fields)
|
||||
response_key = response_field_map.get(field, field)
|
||||
item[response_key] = _fmt_value(row.get(field), field in int_fields)
|
||||
result_list.append(item)
|
||||
|
||||
return Response({
|
||||
|
||||
Reference in New Issue
Block a user