feat: 对接越南AlinPay支付网关(代收+代付)
- 新增 AlinPay 网关核心类:签名/验签/代收/代付/查询/账户接口 - 新增 alinPay trait:充值发起 + 代收回调结算(事务+行锁) - 修改 admin/agent Report:提现审批自动路由 ALIN_VN 发起代付 - 新增 Pcapi:银行卡提现申请 + 越南银行列表接口 - 修改 Crypto:代付回调/订单查询/账户查询入口 - 新增越南区 area_list(id=3) + alinPay pay_list 配置 - DDL: user_withdraw 表增加 pay_channel/ext 字段
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
namespace app\agent\controller;
|
||||
use pay\Usdt;
|
||||
use pay\Ybf;
|
||||
use pay\AlinPay;
|
||||
use \think\Controller;
|
||||
use think\Lang;
|
||||
use \think\Session;
|
||||
@@ -2644,8 +2645,8 @@ class Report Extends Common{
|
||||
die(json_encode(['code'=>0,'msg'=>'非待审核状态无法操作!']));
|
||||
}
|
||||
|
||||
// 审核通过
|
||||
$withdrawChannel = "YBF";
|
||||
// 审核通过 - 根据提现记录的支付渠道路由
|
||||
$withdrawChannel = $withdraw['pay_channel'] ?: 'YBF';
|
||||
$withdrawResult = [];
|
||||
if($withdrawChannel == "USDT"){
|
||||
$Usdt = new Usdt();
|
||||
@@ -2665,13 +2666,35 @@ class Report Extends Common{
|
||||
'type' => 'YBF',
|
||||
'err_msg' => $res['message'],
|
||||
];
|
||||
}else if($withdrawChannel == "ALIN_VN"){
|
||||
// 越南AlinPay代付
|
||||
$ext = json_decode($withdraw['ext'], true) ?: [];
|
||||
$pay_list = config('pay_list');
|
||||
$notifyUrl = $pay_list['alinPay']['payment_notify_url'];
|
||||
|
||||
$alinPay = new AlinPay();
|
||||
$res = $alinPay->createPayment(
|
||||
$withdraw['order_no'],
|
||||
sprintf('%.2f', $withdraw['amount']),
|
||||
$ext['accountName'] ?? '',
|
||||
$ext['accountNumber'] ?? '',
|
||||
$ext['bankCode'] ?? '',
|
||||
$ext['bankName'] ?? '',
|
||||
$notifyUrl
|
||||
);
|
||||
$withdrawResult = [
|
||||
'status' => (is_array($res) && isset($res['code']) && $res['code'] == 200) ? true : false,
|
||||
'type' => 'ALIN_VN',
|
||||
'out_trade_no' => $res['data']['trade_no'] ?? '',
|
||||
'err_msg' => $res['message'] ?? '请求失败',
|
||||
];
|
||||
}
|
||||
if(empty($withdrawResult)){
|
||||
die(json_encode(['code'=>0,'msg'=>'未配置支付渠道!']));
|
||||
}
|
||||
|
||||
if($withdrawResult['status']){
|
||||
Db::name('user_withdraw')->where('id',$id)->update([
|
||||
$updateData = [
|
||||
'status' => 'AGREE',
|
||||
'type' => $withdrawResult['type'] ?? '',
|
||||
'from_address' => $withdrawResult['from_address'] ?? '',
|
||||
@@ -2680,7 +2703,11 @@ class Report Extends Common{
|
||||
'operator_id' => $user_info['id'],
|
||||
'operator_username' => $user_info['username'],
|
||||
'operator_nickname' => $user_info['nickname']
|
||||
]);
|
||||
];
|
||||
if(!empty($withdrawResult['out_trade_no'])){
|
||||
$updateData['out_trade_no'] = $withdrawResult['out_trade_no'];
|
||||
}
|
||||
Db::name('user_withdraw')->where('id',$id)->update($updateData);
|
||||
die(json_encode(['code'=>1,'msg'=>'审核通过!']));
|
||||
}else{
|
||||
Db::startTrans();
|
||||
|
||||
Reference in New Issue
Block a user