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

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

查看文件

@@ -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,