fix(admin): 下线退款重发功能并优化用户详情页布局
- 移除后台订单和支付流水的退款重发按钮及接口 - 新增用户详情页分区导航和资金流水筛选功能 - 升级账号安全页面为企业资质认证功能 - 新增企业资质相关测试用例和图标 - 升级版本号至1.0.96
这个提交包含在:
@@ -1476,6 +1476,18 @@ class PaymentService
|
||||
return $wd;
|
||||
}
|
||||
|
||||
if ((string)$lockedWd['out_bill_no'] !== $outBillNo) {
|
||||
throw new \RuntimeException('转账单号已变更,请重新查询');
|
||||
}
|
||||
if (in_array($lockedWd['status'], ['done', 'reject'], true)) {
|
||||
$compatible = ($lockedWd['status'] === 'done' && $wxState === 'SUCCESS')
|
||||
|| ($lockedWd['status'] === 'reject' && in_array($wxState, ['FAIL', 'CANCELLED'], true));
|
||||
if (!$compatible && in_array($wxState, ['SUCCESS', 'FAIL', 'CANCELLED'], true)) {
|
||||
throw new \RuntimeException('微信转账终态与本地记录不一致,请人工核查');
|
||||
}
|
||||
Db::commit();
|
||||
return $lockedWd;
|
||||
}
|
||||
$masterId = (int)$lockedWd['master_id'];
|
||||
$master = Db::name('master')->where('id', $masterId)->lock(true)->find();
|
||||
$amount = round((float)$lockedWd['amount'], 2);
|
||||
@@ -2320,14 +2332,18 @@ class PaymentService
|
||||
throw new \InvalidArgumentException('充值支付单不存在');
|
||||
}
|
||||
|
||||
if ($payOrder['scene'] !== 'recharge') {
|
||||
throw new \InvalidArgumentException('该支付单不是充值流水');
|
||||
}
|
||||
if ($payOrder['status'] === 'paid') {
|
||||
return [
|
||||
'paid' => true,
|
||||
'already_processed' => true,
|
||||
'amount' => (float)$payOrder['amount'],
|
||||
'user_id' => (int)$payOrder['user_id'],
|
||||
'paid' => true, 'already_processed' => true,
|
||||
'amount' => (float)$payOrder['amount'], 'user_id' => (int)$payOrder['user_id'],
|
||||
];
|
||||
}
|
||||
if ($payOrder['status'] !== 'pending') {
|
||||
throw new \InvalidArgumentException('充值单当前状态不允许再次入账');
|
||||
}
|
||||
|
||||
$wxSvc = new WxPayV3Service();
|
||||
if ($wxTxData === null) {
|
||||
@@ -2352,10 +2368,16 @@ class PaymentService
|
||||
Db::startTrans();
|
||||
try {
|
||||
$lockedPay = Db::name('pay_order')->where('id', (int)$payOrder['id'])->lock(true)->find();
|
||||
if (!$lockedPay || $lockedPay['scene'] !== 'recharge') {
|
||||
throw new \InvalidArgumentException('充值流水不存在或场景不正确');
|
||||
}
|
||||
if ($lockedPay['status'] === 'paid') {
|
||||
Db::commit();
|
||||
return ['paid' => true, 'already_processed' => true, 'amount' => (float)$lockedPay['amount']];
|
||||
}
|
||||
if ($lockedPay['status'] !== 'pending') {
|
||||
throw new \InvalidArgumentException('充值单当前状态不允许再次入账');
|
||||
}
|
||||
|
||||
$uid = (int)$lockedPay['user_id'];
|
||||
$lockedUser = Db::name('user')->where('id', $uid)->lock(true)->find();
|
||||
@@ -2492,6 +2514,29 @@ class PaymentService
|
||||
throw new \RuntimeException('订单不存在');
|
||||
}
|
||||
|
||||
// 事务外的订单快照可能已经过期,持锁后必须重新验证所有影响扣款的状态和金额。
|
||||
if ($scene === 'order' && ((int)$lockedOrder['pay_status'] !== 0
|
||||
|| (int)$lockedOrder['status'] !== OrderStatus::PENDING_PAY
|
||||
|| round((float)$lockedOrder['pay_amount'], 2) !== $payAmount)) {
|
||||
throw new \InvalidArgumentException('订单状态或金额已变更,请刷新后重试');
|
||||
}
|
||||
if ($scene === 'diff' && ((int)$lockedOrder['diff_status'] !== 1
|
||||
|| round((float)$lockedOrder['diff_amount'], 2) !== $payAmount)) {
|
||||
throw new \InvalidArgumentException('增项状态或金额已变更,请刷新后重试');
|
||||
}
|
||||
if ($scene === 'quote') {
|
||||
$lockedQuote = Db::name('order_quote')->where('id', $quoteId)->where('order_id', $orderId)->lock(true)->find();
|
||||
if ((int)$lockedOrder['status'] !== OrderStatus::QUOTING || (int)$lockedOrder['master_id'] > 0
|
||||
|| !$lockedQuote || $lockedQuote['status'] !== 'wait'
|
||||
|| (int)$lockedQuote['master_id'] !== $masterId
|
||||
|| round((float)$lockedQuote['amount'], 2) !== round((float)$quote['amount'], 2)
|
||||
|| round((float)$lockedOrder['discount_amount'], 2) !== round((float)$order['discount_amount'], 2)
|
||||
|| (int)$lockedOrder['pay_status'] !== (int)$order['pay_status']
|
||||
|| round((float)$lockedOrder['pay_amount'], 2) !== round((float)$order['pay_amount'], 2)) {
|
||||
throw new \InvalidArgumentException('报价或订单状态已变更,请刷新后重试');
|
||||
}
|
||||
$quote = $lockedQuote;
|
||||
}
|
||||
$newBalance = round($userMoney - $payAmount, 2);
|
||||
|
||||
// 1. 扣减用户余额
|
||||
|
||||
在新工单中引用
屏蔽一个用户