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

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

查看文件

@@ -22,6 +22,8 @@ class Reward extends Common
'skip_reason',
'skip_reason_text',
'formula',
'wallet_type',
'wallet_type_text',
];
public function statusList()
@@ -91,6 +93,41 @@ class Reward extends Common
return \addons\shopro\service\partner\IdentityService::formatMadow($value);
}
public function getWalletTypeAttr($value, $data)
{
$ext = $data['ext'] ?? [];
if (is_string($ext)) {
$ext = json_decode($ext, true) ?: [];
}
if (!empty($ext['wallet_type'])) {
return $ext['wallet_type'];
}
$rewardType = $data['reward_type'] ?? '';
if (in_array($rewardType, ['voucher_grant', 'voucher_release'], true)) {
return 'voucher';
}
if ($rewardType === 'madow_share') {
return 'madow';
}
if (intval($data['user_id'] ?? 0) === 0) {
return 'system';
}
return PartnerConfig::rewardWalletType();
}
public function getWalletTypeTextAttr($value, $data)
{
$type = $this->getWalletTypeAttr(null, $data);
$map = [
'money' => '商城余额',
'commission' => '佣金钱包',
'voucher' => '消费补贴券',
'madow' => '分红马豆',
'system' => '平台留存',
];
return $map[$type] ?? '商城余额';
}
public function buyer()
{
return $this->belongsTo(UserModel::class, 'buyer_id', 'id')->field('id, nickname, avatar, mobile');