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

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

查看文件

@@ -142,11 +142,14 @@ class User extends Common
: ('已暂停领取' . ($ago !== null ? '(距今 ' . $ago . ' 天)' : '(从未下单)'));
}
// 累计现金收益统计
// 累计现金收益统计(与 IdentityService 严格对齐,兼顾历史分销与收益中心)
$agentTotalIncome = floatval($agent->total_income ?? 0);
$totalCash = \app\admin\model\shopro\partner\Reward::where('user_id', $id)
->where('status', 1)
->where('amount', '>', 0)
->sum('amount');
$alignedTotalIncome = max($agentTotalIncome, (float) $totalCash);
$push3Cash = \app\admin\model\shopro\partner\Reward::where('user_id', $id)
->where('status', 1)
->where('amount', '>', 0)
@@ -158,9 +161,12 @@ class User extends Common
->where('reward_type', '<>', 'push3')
->sum('amount');
$data['income_total_cash'] = number_format((float) $totalCash, 2, '.', '');
$data['income_total_cash'] = number_format($alignedTotalIncome, 2, '.', '');
$data['total_income'] = number_format($alignedTotalIncome, 2, '.', '');
$data['push3_cash_income'] = number_format((float) $push3Cash, 2, '.', '');
$data['partner_exclusive_cash'] = number_format((float) $partnerExclusiveCash, 2, '.', '');
$data['money'] = number_format(floatval($user->money ?? 0), 2, '.', '');
$data['commission'] = number_format(floatval($user->commission ?? 0), 2, '.', '');
// 兑换券计划资产统计
$voucherTotal = floatval($agent->voucher_total ?? 0);

查看文件

@@ -65,12 +65,26 @@ class WalletLog extends Common
}
/**
* 佣金记录
* 佣金与收益记录
*/
public function commission($id)
{
$list_rows = $this->request->param('list_rows', 10);
$walletLogs = WalletLogModel::where('user_id', $id)->commission()->order('id', 'desc')->paginate($list_rows);
$rewardEvents = [
'push3', 'maker_diff', 'maker_peer', 'maker_overtaken',
'team_venue', 'team_county', 'venue_peer', 'county_peer',
'venue_share', 'county_share', 'reward_income', 'transfer_by_commission', 'transfer_to_money'
];
$walletLogs = WalletLogModel::where('user_id', $id)
->where(function ($query) use ($rewardEvents) {
$query->where('type', 'commission')
->whereOr(function ($sub) use ($rewardEvents) {
$sub->where('type', 'money')->whereIn('event', $rewardEvents);
});
})
->order('id', 'desc')
->paginate($list_rows);
// 多态关联 oper
$morphs = [