From d664c7eb8584b42d23604f92254817c6db101051 Mon Sep 17 00:00:00 2001 From: chen Date: Mon, 21 Sep 2026 15:13:32 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=90=8C=E6=AD=A5=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=E7=BB=93=E8=BD=AC=E8=84=9A=E6=9C=AC=E4=B8=8E=E6=B3=A8=E9=87=8A?= =?UTF-8?q?=E4=B8=AD=E6=96=87=E6=A1=88=E7=BB=9F=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../console/PartnerTransferCommission.php | 12 +++++----- addons/shopro/controller/user/User.php | 2 +- scripts/fix_order_withdraw_wallet.php | 22 +++++++++---------- scripts/transfer_all_commission_to_money.php | 10 ++++----- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/addons/shopro/console/PartnerTransferCommission.php b/addons/shopro/console/PartnerTransferCommission.php index d54316f..a5a87f2 100644 --- a/addons/shopro/console/PartnerTransferCommission.php +++ b/addons/shopro/console/PartnerTransferCommission.php @@ -9,7 +9,7 @@ use think\console\input\Option; use addons\shopro\service\partner\WalletMigrationService; /** - * 历史收益全量结转至商城余额控制台命令 + * 历史收益全量结转至钱包余额控制台命令 */ class PartnerTransferCommission extends Command { @@ -18,7 +18,7 @@ class PartnerTransferCommission extends Command $this->setName('shopro:partner:transfer-commission') ->addOption('dry-run', 'd', Option::VALUE_NONE, '只读试算预览,不真实扣减与增加资金') ->addOption('force', 'f', Option::VALUE_NONE, '强制执行,不提示二次确认') - ->setDescription('将所有会员账户已有佣金收益全量结转至商城余额'); + ->setDescription('将所有会员账户已有佣金收益全量结转至钱包余额'); } protected function execute(Input $input, Output $output) @@ -27,7 +27,7 @@ class PartnerTransferCommission extends Command $force = (bool) $input->getOption('force'); $output->writeln("========================================================"); - $output->writeln(" 恒联数通 · 历史收益全量结转至商城余额工具"); + $output->writeln(" 恒联数通 · 历史收益全量结转至钱包余额工具"); $output->writeln("========================================================"); $service = new WalletMigrationService(); @@ -44,7 +44,7 @@ class PartnerTransferCommission extends Command $output->writeln("\n部分待结转会员抽样(前 10 名):"); foreach (array_slice($preview['samples'], 0, 10) as $i => $s) { $idx = $i + 1; - $output->writeln(" [{$idx}] 会员ID: {$s['id']} | 手机: {$s['mobile']} | 当前佣金: ¥{$s['current_commission']} -> 商城余额: ¥{$s['current_money']} (结转后预计: ¥{$s['target_money']})"); + $output->writeln(" [{$idx}] 会员ID: {$s['id']} | 手机: {$s['mobile']} | 当前佣金: ¥{$s['current_commission']} -> 钱包余额: ¥{$s['current_money']} (结转后预计: ¥{$s['target_money']})"); } if ($dryRun) { @@ -53,7 +53,7 @@ class PartnerTransferCommission extends Command } if (!$force) { - $output->writeln("\n【安全警告】即将对全量 {$preview['total_users']} 名会员执行结转,将 ¥{$preview['total_commission']} 元佣金划入商城余额!"); + $output->writeln("\n【安全警告】即将对全量 {$preview['total_users']} 名会员执行结转,将 ¥{$preview['total_commission']} 元佣金划入钱包余额!"); $output->writeln("若确认执行,请增加参数 --force 或 -f,例如:"); $output->writeln("php think shopro:partner:transfer-commission --force"); return 1; @@ -66,7 +66,7 @@ class PartnerTransferCommission extends Command if ($err) { $output->writeln(" [{$current}/{$total}] 会员 {$userId} 结转失败: {$err}"); } else { - $output->writeln(" [{$current}/{$total}] 会员 {$userId} 成功结转 ¥" . number_format($amount, 2, '.', '') . " 元至商城余额"); + $output->writeln(" [{$current}/{$total}] 会员 {$userId} 成功结转 ¥" . number_format($amount, 2, '.', '') . " 元至钱包余额"); } }); diff --git a/addons/shopro/controller/user/User.php b/addons/shopro/controller/user/User.php index caaecee..b1de8c1 100644 --- a/addons/shopro/controller/user/User.php +++ b/addons/shopro/controller/user/User.php @@ -98,7 +98,7 @@ class User extends Common } } $data = array_merge($user->toArray(), $partner); - // 对齐用户余额字段:统一映射商城余额,避免前端不同字段读取出现口径偏差 + // 对齐用户余额字段:统一映射钱包余额,避免前端不同字段读取出现口径偏差 $data['balance'] = $user->money; $this->success('个人详情', $data); diff --git a/scripts/fix_order_withdraw_wallet.php b/scripts/fix_order_withdraw_wallet.php index f02a79b..182d824 100644 --- a/scripts/fix_order_withdraw_wallet.php +++ b/scripts/fix_order_withdraw_wallet.php @@ -2,10 +2,10 @@ /** * 修正提现订单 W202601240278270146002000 钱包扣款类型 * 业务目标: - * 1. 扣减用户 20 的商城余额 money 1060.00 元(提现本金 1000 + 手续费 60) + * 1. 扣减用户 20 的钱包余额 money 1060.00 元(提现本金 1000 + 手续费 60) * 2. 返还用户 20 被误扣的佣金 commission 1060.00 元 * 3. 记录标准审计流水(WalletLog) - * 4. 更新提现订单 withdraw_info 标记为商城余额提现 + * 4. 更新提现订单 withdraw_info 标记为钱包余额提现 */ define('APP_PATH', __DIR__ . '/../application/'); @@ -68,11 +68,11 @@ try { $currentCommission = (string)$user['commission']; echo "用户校正前资金:\n"; - echo "- 商城余额 money: ¥{$currentMoney}\n"; + echo "- 钱包余额 money: ¥{$currentMoney}\n"; echo "- 佣金钱包 commission: ¥{$currentCommission}\n\n"; if (bccomp($currentMoney, $totalNeedDeduct, 2) < 0) { - throw new \Exception("用户商城余额不足扣减 ¥{$totalNeedDeduct}(当前余额:¥{$currentMoney})"); + throw new \Exception("用户钱包余额不足扣减 ¥{$totalNeedDeduct}(当前余额:¥{$currentMoney})"); } // 检查是否已经校正过(防重幂等) @@ -101,7 +101,7 @@ try { $now = time(); - // 4. 写入商城余额扣减日志 + // 4. 写入钱包余额扣减日志 Db::name('shopro_user_wallet_log')->insert([ 'user_id' => $userId, 'type' => 'money', @@ -109,13 +109,13 @@ try { 'amount' => -floatval($totalNeedDeduct), 'before' => $currentMoney, 'after' => $newMoney, - 'memo' => '修正提现单W202601240278270146002000扣除商城余额', + 'memo' => '修正提现单W202601240278270146002000扣除钱包余额', 'ext' => json_encode([ 'withdraw_id' => (string)$withdraw['id'], 'withdraw_sn' => $withdrawSn, 'amount' => (string)$amount, 'charge_fee' => (string)$chargeFee, - 'fix_reason' => '修正扣错佣金为扣商城余额', + 'fix_reason' => '修正扣错佣金为扣钱包余额', ], JSON_UNESCAPED_UNICODE), 'oper_type' => 'admin', 'oper_id' => 1, @@ -146,7 +146,7 @@ try { // 6. 更新提现单 withdraw_info $withdrawInfo = json_decode($withdraw['withdraw_info'], true) ?: []; $withdrawInfo['wallet_type'] = 'money'; - $withdrawInfo['提现资产'] = '商城余额'; + $withdrawInfo['提现资产'] = '钱包余额'; Db::name('shopro_withdraw')->where('id', $withdraw['id'])->update([ 'withdraw_info' => json_encode($withdrawInfo, JSON_UNESCAPED_UNICODE), 'updatetime' => $now, @@ -155,7 +155,7 @@ try { // 7. 写入提现单操作日志 Db::name('shopro_withdraw_log')->insert([ 'withdraw_id' => $withdraw['id'], - 'content' => '系统财务校正:已将提现扣款由佣金钱包更正为商城可用余额(扣除余额 ¥' . $totalNeedDeduct . ',退回佣金 ¥' . $totalNeedDeduct . ')', + 'content' => '系统财务校正:已将提现扣款由佣金钱包更正为钱包可用余额(扣除余额 ¥' . $totalNeedDeduct . ',退回佣金 ¥' . $totalNeedDeduct . ')', 'oper_type' => 'admin', 'oper_id' => 1, 'createtime' => $now, @@ -164,9 +164,9 @@ try { Db::commit(); echo "【成功】账目校正完成:\n"; - echo "- 商城余额 money: ¥{$currentMoney} -> ¥{$newMoney}(已成功扣除 ¥{$totalNeedDeduct})\n"; + echo "- 钱包余额 money: ¥{$currentMoney} -> ¥{$newMoney}(已成功扣除 ¥{$totalNeedDeduct})\n"; echo "- 佣金钱包 commission: ¥{$currentCommission} -> ¥{$newCommission}(已退还误扣 ¥{$totalNeedDeduct})\n"; - echo "- 提现订单已标记为「商城余额」提现\n"; + echo "- 提现订单已标记为「钱包余额」提现\n"; echo "- 钱包流水与提现操作日志已写入\n"; } catch (\Exception $e) { diff --git a/scripts/transfer_all_commission_to_money.php b/scripts/transfer_all_commission_to_money.php index 1d6d786..e2a58bf 100644 --- a/scripts/transfer_all_commission_to_money.php +++ b/scripts/transfer_all_commission_to_money.php @@ -1,7 +1,7 @@ $s) { $idx = $i + 1; - echo " [{$idx}] 会员ID: {$s['id']} | 手机: {$s['mobile']} | 当前佣金: ¥{$s['current_commission']} -> 商城余额: ¥{$s['current_money']} (预计转后: ¥{$s['target_money']})\n"; + echo " [{$idx}] 会员ID: {$s['id']} | 手机: {$s['mobile']} | 当前佣金: ¥{$s['current_commission']} -> 钱包余额: ¥{$s['current_money']} (预计转后: ¥{$s['target_money']})\n"; } if ($dryRun) { @@ -74,7 +74,7 @@ if ($dryRun) { } if (!$force) { - echo "\n【安全警告】即将对 {$preview['total_users']} 名会员执行结转,将 ¥{$preview['total_commission']} 元转入商城余额!\n"; + echo "\n【安全警告】即将对 {$preview['total_users']} 名会员执行结转,将 ¥{$preview['total_commission']} 元转入钱包余额!\n"; echo "若确认执行,请增加参数 --force 或 -f,例如:\n"; echo "php scripts/transfer_all_commission_to_money.php --force\n"; exit(1); @@ -87,7 +87,7 @@ $res = $service->transferAll(false, function ($current, $total, $userId, $amount if ($err) { echo " [{$current}/{$total}] 会员 {$userId} 结转失败: {$err}\n"; } else { - echo " [{$current}/{$total}] 会员 {$userId} 成功结转 ¥" . number_format($amount, 2, '.', '') . " 元至商城余额\n"; + echo " [{$current}/{$total}] 会员 {$userId} 成功结转 ¥" . number_format($amount, 2, '.', '') . " 元至钱包余额\n"; } });