瀏覽代碼

优化运营成本统计

peng 1 年之前
父節點
當前提交
f7320597c4
共有 1 個文件被更改,包括 1 次插入2 次删除
  1. 1 2
      Controller/Cron/CronTaskController.py

+ 1 - 2
Controller/Cron/CronTaskController.py

@@ -1212,11 +1212,10 @@ class CronCollectDataView(View):
                     if CONFIG_INFO == CONFIG_CN:  # 国内要换算汇率
                     if CONFIG_INFO == CONFIG_CN:  # 国内要换算汇率
                         storage_cost = round(storage_cost * 7, 2)
                         storage_cost = round(storage_cost * 7, 2)
                         api_cost = round(api_cost * 7, 2)
                         api_cost = round(api_cost * 7, 2)
+                    profit = round(monthly_income - storage_cost - api_cost, 2)  # 利润=月结算金额-月成本
                     if monthly_income == 0.0:
                     if monthly_income == 0.0:
-                        profit = 0
                         profit_margin = 0
                         profit_margin = 0
                     else:
                     else:
-                        profit = round(monthly_income - storage_cost - api_cost, 2)  # 利润=月结算金额-月成本
                         profit_margin = round(profit / month_average_price, 2)  # 利润率=利润/每月收入分摊
                         profit_margin = round(profit / month_average_price, 2)  # 利润率=利润/每月收入分摊
                     OperatingCosts.objects.filter(time=start_time_stamp, order_id=item['order_id'],
                     OperatingCosts.objects.filter(time=start_time_stamp, order_id=item['order_id'],
                                                   uid=item['uid']).update(day_average_price=day_average_price,
                                                   uid=item['uid']).update(day_average_price=day_average_price,