|
@@ -227,7 +227,19 @@ class AgentDeviceView(View):
|
|
|
|
|
|
result = self.calculate_profit_or_revenue(agent_device_orders, package_details, timeUnit, metric_type,
|
|
|
start_time, end_time)
|
|
|
- return response.json(0, {'list': result})
|
|
|
+ total_4G = Decimal('0.00')
|
|
|
+ total_cloud = Decimal('0.00')
|
|
|
+ # 遍历result列表来累加4G和云存的值
|
|
|
+ for item in result:
|
|
|
+ total_4G = item['4G'] + total_4G
|
|
|
+ total_cloud = item['云存'] + total_cloud
|
|
|
+ response_data = {
|
|
|
+ "list": result,
|
|
|
+ "total_4G": total_4G, # 4G的总和
|
|
|
+ "total_云存": total_cloud, # 云存的总和
|
|
|
+ }
|
|
|
+
|
|
|
+ return response.json(0, response_data)
|
|
|
|
|
|
except Exception as e:
|
|
|
error_msg = f"error_line:{traceback.format_exc()}, error_msg:{str(e)}"
|