0.使用模拟数据进行充值和提现
1.优化提现接口/api/finance/withdrawCreate 2.优化充值接口/api/finance/depositCreate
This commit is contained in:
@@ -4,6 +4,7 @@ namespace app\admin\controller\order;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use app\common\library\finance\DDPayGateway;
|
||||
use app\common\library\finance\MockPay;
|
||||
use support\think\Db;
|
||||
use support\Response;
|
||||
use Throwable;
|
||||
@@ -265,12 +266,21 @@ class WithdrawOrder extends Backend
|
||||
$orderNo = is_string($fresh['order_no'] ?? null) ? trim($fresh['order_no'] ?? '') : strval($fresh['order_no'] ?? '');
|
||||
$receiveType = is_string($fresh['receive_type'] ?? null) ? strtolower(trim($fresh['receive_type'] ?? '')) : '';
|
||||
$payChannel = is_string($fresh['pay_channel'] ?? null) ? strtolower(trim($fresh['pay_channel'] ?? '')) : '';
|
||||
if ($payChannel === '') {
|
||||
$payChannel = 'ddpay';
|
||||
}
|
||||
|
||||
// 当前仅 ddpay + bank 类型自动出金(与移动端 withdrawCreate 校验一致)
|
||||
if ($orderNo !== '' && $receiveType === 'bank' && $payChannel === 'ddpay') {
|
||||
// 模拟出金:审核通过即标记已打款,不回冲、不调用 DDPay
|
||||
if ($orderNo !== '' && MockPay::shouldSimulateWithdrawPayout($payChannel)) {
|
||||
$prevRemark = is_string($fresh['remark'] ?? null) ? trim($fresh['remark']) : '';
|
||||
$mockNote = '[mock] 管理员(' . $adminName . ')审核通过,模拟打款成功';
|
||||
$finalRemark = $prevRemark === '' ? $mockNote : mb_substr($prevRemark . ' | ' . $mockNote, 0, 255);
|
||||
Db::name('withdraw_order')
|
||||
->where('id', $id)
|
||||
->where('status', 1)
|
||||
->update([
|
||||
'status' => 3,
|
||||
'remark' => $finalRemark,
|
||||
'update_time' => time(),
|
||||
]);
|
||||
} elseif ($orderNo !== '' && $receiveType === 'bank' && $payChannel === 'ddpay') {
|
||||
$base = \app\common\library\finance\DDPayGateway::publicBaseUrlForCallbacks($request);
|
||||
if ($base === '') {
|
||||
$base = 'https://' . strval($request->host());
|
||||
@@ -514,12 +524,15 @@ class WithdrawOrder extends Backend
|
||||
]);
|
||||
}
|
||||
|
||||
$finalStatus = Db::name('withdraw_order')->where('id', $id)->value('status');
|
||||
$finalStatusInt = is_numeric($finalStatus) ? intval($finalStatus) : 1;
|
||||
|
||||
return $this->success(__('Approved'), [
|
||||
'id' => $id,
|
||||
'amount' => $newAmount,
|
||||
'fee' => $newFee,
|
||||
'actual_amount' => $newActual,
|
||||
'status' => 1,
|
||||
'status' => $finalStatusInt,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user