chore: 同步历史结转脚本与注释中文案统一
这个提交包含在:
@@ -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) {
|
||||
|
||||
在新工单中引用
屏蔽一个用户