feat(dmepa): 全局统一规范DMEPA命名并优化游客与品酒师身份显示

这个提交包含在:
chen
2026-09-19 15:41:39 +08:00
父节点 3868becc63
当前提交 fd8c1d09cc
共有 65 个文件被更改,包括 1068 次插入 和 390 次删除

查看文件

@@ -333,7 +333,7 @@ class Dashboard extends Common
'filter_type' => 'normal',
];
// 全平台全员合计行 (总马豆与总分佣与顶部大盘完全一致)
// 全平台全员合计行 (总dmepa与总分佣与顶部大盘完全一致)
$allTotalRow = [
'role_key' => 'all_total',
'role_name' => '全平台全员合计',

查看文件

@@ -244,7 +244,7 @@ class Order extends Common
if ($type === 'voucher_grant') {
$amountText = number_format($baseAmount, 2, '.', '') . ' 个';
} elseif ($madow > 0) {
$amountText = \addons\shopro\service\partner\IdentityService::formatMadow($madow) . ' 马豆';
$amountText = \addons\shopro\service\partner\IdentityService::formatMadow($madow) . ' dmepa';
} elseif ($amount > 0) {
$amountText = '¥' . number_format($amount, 2, '.', '');
} else {
@@ -379,7 +379,7 @@ class Order extends Common
}
$platform = $platRows[0];
$amountText = $type === 'madow_share'
? \addons\shopro\service\partner\IdentityService::formatMadow($platMadow) . ' 马豆'
? \addons\shopro\service\partner\IdentityService::formatMadow($platMadow) . ' dmepa'
: '¥' . number_format($platAmount, 2, '.', '');
$items[] = [
@@ -402,7 +402,7 @@ class Order extends Common
'settle_date' => $settleDate,
'status' => 1,
'status_text' => '已入账',
'unit' => $type === 'madow_share' ? '马豆' : '元',
'unit' => $type === 'madow_share' ? 'dmepa' : '元',
'formula' => (string) ($platform->formula ?? ''),
'skip_reason_text' => '',
'tip' => '当日无人参与,奖池进平台',
@@ -429,13 +429,13 @@ class Order extends Common
'each_madow' => $eachMadow,
'total_amount' => number_format($totalAmount, 2, '.', ''),
'total_madow' => \addons\shopro\service\partner\IdentityService::formatMadow($totalMadow),
'amount_text' => $type === 'madow_share' ? ($eachMadow . ' 马豆/人') : ('¥' . $eachAmount . '/人'),
'amount_text' => $type === 'madow_share' ? ($eachMadow . ' dmepa/人') : ('¥' . $eachAmount . '/人'),
'wallet_type' => $type === 'madow_share' ? 'madow' : \addons\shopro\service\partner\PartnerConfig::rewardWalletType(),
'wallet_type_text' => $type === 'madow_share' ? '分红马豆' : (\addons\shopro\service\partner\PartnerConfig::rewardWalletType() === 'money' ? '商城余额' : '佣金钱包'),
'wallet_type_text' => $type === 'madow_share' ? '分红dmepa' : (\addons\shopro\service\partner\PartnerConfig::rewardWalletType() === 'money' ? '商城余额' : '佣金钱包'),
'settle_date' => $settleDate,
'status' => 1,
'status_text' => '已入账',
'unit' => $type === 'madow_share' ? '马豆' : '元',
'unit' => $type === 'madow_share' ? 'dmepa' : '元',
'formula' => (string) ($first->formula ?? ''),
'skip_reason_text' => '',
'tip' => '日结均分(不列出参与用户名单)',

查看文件

@@ -51,7 +51,7 @@ class Reward extends Common
'role_text' => '受益身份',
'amount' => '结算金额',
'wallet_type_text' => '入账账户',
'madow' => '马豆',
'madow' => 'dmepa',
'base_amount' => '基数',
'status_text' => '状态',
'formula' => '测算摘要',
@@ -108,7 +108,7 @@ class Reward extends Common
'madow' => $formattedTotalMadow,
'base_amount' => '-',
'status_text' => '已汇总',
'formula' => "总现金: {$totalAmount}, 总马豆: {$formattedTotalMadow}",
'formula' => "总现金: {$totalAmount}, 总dmepa: {$formattedTotalMadow}",
];
}
return $newDatas;

查看文件

@@ -40,7 +40,7 @@ class User extends Common
$list = $paginator->items();
foreach ($list as &$user) {
$agent = $user->agent;
$partner = \addons\shopro\service\partner\IdentityService::attachProfile($agent, $rate);
$partner = \addons\shopro\service\partner\IdentityService::attachProfile($agent, $rate, $user);
foreach ($partner as $k => $v) {
$user->$k = $v;
}
@@ -110,7 +110,7 @@ class User extends Common
$this->error(__('No Results were found'));
}
$agent = \addons\shopro\service\partner\IdentityService::findAgent($id);
$partner = \addons\shopro\service\partner\IdentityService::attachProfile($agent);
$partner = \addons\shopro\service\partner\IdentityService::attachProfile($agent, null, $user);
$data = array_merge($user->toArray(), $partner);
$data['has_agent'] = (bool) $agent;
@@ -363,7 +363,7 @@ class User extends Common
return WalletService::change($userId, 'score', $amount, 'admin_recharge', [], $memo ?: '后台管理调整积分');
}
// 对于马豆 (madow) 与兑换券 (voucher),属于合伙人二开资产体系
// 对于dmepa (madow) 与兑换券 (voucher),属于合伙人二开资产体系
$agent = \app\admin\model\shopro\commission\Agent::where('user_id', $userId)->lock(true)->find();
if (!$agent) {
// 自动为用户初始化分销商记录,以便承载二开资产体系
@@ -392,13 +392,13 @@ class User extends Common
$role = !empty($identity['identities']) ? end($identity['identities']) : 'taster';
if ($type === 'madow') {
// 马豆充值或扣除 (8位小数精度)
// dmepa充值或扣除 (8位小数精度)
$currentMadow = (string) ($agent->madow ?? '0.00000000');
$amountMadow = function_exists('bcadd') ? bcadd((string) $amount, '0', 8) : number_format((float) $amount, 8, '.', '');
$afterMadow = function_exists('bcadd') ? bcadd($currentMadow, $amountMadow, 8) : ($currentMadow + $amountMadow);
if ((float) $afterMadow < 0) {
error_stop('当前持仓马豆不足,无法扣除');
error_stop('当前持仓dmepa不足,无法扣除');
}
$rate = (new \addons\shopro\service\partner\RateService())->currentRate();
@@ -417,8 +417,8 @@ class User extends Common
'rate' => $rate,
'settle_date' => null, // 设为 null,避免与每日均分的 uk_daily_user_type 发生索引冲突
'ext' => [
'formula' => ($amount > 0 ? '管理员充值马豆: +' : '管理员扣除马豆: ') . $amountMadow,
'memo' => $memo ?: ($amount > 0 ? '管理员充值马豆' : '管理员扣除马豆'),
'formula' => ($amount > 0 ? '管理员充值dmepa: +' : '管理员扣除dmepa: ') . $amountMadow,
'memo' => $memo ?: ($amount > 0 ? '管理员充值dmepa' : '管理员扣除dmepa'),
'operator' => $operDesc,
'before' => $currentMadow,
'after' => $afterMadow,