diff --git a/app/tasks/daily_tasks.py b/app/tasks/daily_tasks.py index 69e8b97..f378527 100644 --- a/app/tasks/daily_tasks.py +++ b/app/tasks/daily_tasks.py @@ -244,6 +244,8 @@ async def daily_partner_settlement(): total_order_count = 0 total_original_amount = 0 total_final_amount = 0 + # 初始化沉淀金额总计 + total_profit_sediment = 0 settlement_history = [] for stat in yesterday_stats: @@ -307,7 +309,7 @@ async def daily_partner_settlement(): } # 如果没有运营商、服务商,则需要沉淀到平台 - total_profit_sediment = 0 + community_profit_sediment = 0 # 计算每个运营商的分成金额 if len(partner_ids) > 0: @@ -325,7 +327,7 @@ async def daily_partner_settlement(): account_manager = AccountManager(db) account_manager.change_balance(partner_id, per_partner_profit, f"【运营商】 {stat.community_name} 订单收益") else: - total_profit_sediment += partner_profit + community_profit_sediment += partner_profit # 计算服务商分成 @@ -340,7 +342,7 @@ async def daily_partner_settlement(): account_manager = AccountManager(db) account_manager.change_balance(community.admin_id, admin_profit, f"【服务商】 {stat.community_name} 订单收益") else: - total_profit_sediment += admin_profit + community_profit_sediment += admin_profit # 计算配送员分成 print(f"配送员({delivery_profit_sharing/100}%) 分成金额: {delivery_profit}") @@ -354,10 +356,12 @@ async def daily_partner_settlement(): # 计算平台分成 # 计算分成 + 沉淀金额 - final_platform_profit = platform_profit + total_profit_sediment + final_platform_profit = platform_profit + community_profit_sediment - print(f"平台({platform_profit_sharing/100}%) 分成: {platform_profit} + 沉淀金额: {total_profit_sediment}") + print(f"平台({platform_profit_sharing/100}%) 分成: {platform_profit} + 沉淀金额: {community_profit_sediment}") total_platform_profit += final_platform_profit + # 累加到总沉淀金额 + total_profit_sediment += community_profit_sediment settle_details["platform_profit"] = { "user_id": settings.PLATFORM_USER_ID, diff --git a/jobs.sqlite b/jobs.sqlite index b100100..39a2835 100644 Binary files a/jobs.sqlite and b/jobs.sqlite differ