feat: 收益全额直入商城余额、存量结转与奖项名称全局规范化对齐

这个提交包含在:
chen
2026-09-19 11:49:57 +08:00
父节点 85947e43ae
当前提交 aca0d3c671
共有 83 个文件被更改,包括 4146 次插入 和 443 次删除

查看文件

@@ -303,16 +303,18 @@ class Agent extends Commission
->column('id');
if (empty($teamUserIds)) {
$selfAgent = AgentModel::where('user_id', $agentId)->find();
$selfUser = UserModel::where('id', $agentId)->find();
return [
'total_count' => 0,
'active_count' => 0,
'expiring_count' => 0,
'inactive_count' => 0,
'partner_count' => 0,
'team_total_consume' => '0.00',
'team_total_consume' => \addons\shopro\service\partner\IdentityService::formatMoney($selfUser->total_consume ?? 0),
'team_total_reward' => '0.00',
'team_month_reward' => '0.00',
'team_order_count' => 0,
'team_order_count' => intval($selfAgent->child_order_count_0 ?? 0),
];
}
@@ -348,8 +350,17 @@ class Agent extends Commission
$inactiveCount += $missingAgentCount;
}
// 1. 团队累计自购总业绩
$teamTotalConsume = UserModel::whereIn('id', $teamUserIds)->sum('total_consume');
// 1. 团队累计自购总业绩与团队订单总数(统一使用包含本人自购的分销团队全口径)
$selfAgent = AgentModel::where('user_id', $agentId)->find();
$selfUser = UserModel::where('id', $agentId)->find();
$teamTotalConsume = isset($selfAgent->child_order_money_all) && floatval($selfAgent->child_order_money_all) > 0
? floatval($selfAgent->child_order_money_all)
: (UserModel::whereIn('id', $teamUserIds)->sum('total_consume') + floatval($selfUser->total_consume ?? 0));
$teamOrderCount = isset($selfAgent->child_order_count_all) && intval($selfAgent->child_order_count_all) > 0
? intval($selfAgent->child_order_count_all)
: ($teamOrderCount + intval($selfAgent->child_order_count_0 ?? 0));
// 2. 团队成员为当前用户贡献的累计收益与本月收益
$monthStart = strtotime(date('Y-m-01 00:00:00'));