|
@@ -245,7 +245,7 @@ class WalletWithdrawRecordService
|
|
|
|
|
|
// 使用 EasyWeChat 支付实例
|
|
|
$config = config('wechat.pay.default');
|
|
|
- $app = \EasyWeChat\Pay\Application::fromConfig($config);
|
|
|
+ $app = new \EasyWeChat\Pay\Application($config);
|
|
|
|
|
|
// 生成商户订单号
|
|
|
$outTradeNo = 'W' . date('YmdHis') . str_pad($record->id, 6, '0', STR_PAD_LEFT);
|
|
@@ -264,21 +264,23 @@ class WalletWithdrawRecordService
|
|
|
]);
|
|
|
|
|
|
try {
|
|
|
- // 使用商户转账到零钱接口
|
|
|
- $response = $app->getClient()->postJson('v3/transfer/batches', [
|
|
|
+ // 使用商家转账接口
|
|
|
+ $response = $app->getClient()->postJson('v3/fund-app/mch-transfer/transfer-bills', [
|
|
|
'appid' => $config['app_id'],
|
|
|
- 'out_batch_no' => $outTradeNo,
|
|
|
- 'batch_name' => '提现到零钱',
|
|
|
- 'batch_remark' => '用户提现',
|
|
|
- 'total_amount' => (int)bcmul($record->amount, '100'),
|
|
|
- 'total_num' => 1,
|
|
|
- 'transfer_detail_list' => [
|
|
|
+ 'out_bill_no' => $outTradeNo,
|
|
|
+ 'transfer_scene_id' => '1001', // 现金营销场景
|
|
|
+ 'openid' => $record->withdraw_account,
|
|
|
+ // 'user_name' => $record->withdraw_account_name,
|
|
|
+ 'transfer_amount' => (int)bcmul($record->amount, '100'),
|
|
|
+ 'transfer_remark' => '提现到零钱',
|
|
|
+ 'transfer_scene_report_infos' => [
|
|
|
[
|
|
|
- 'out_detail_no' => $outTradeNo,
|
|
|
- 'transfer_amount' => (int)bcmul($record->amount, '100'),
|
|
|
- 'transfer_remark' => '提现到零钱',
|
|
|
- 'openid' => $record->withdraw_account,
|
|
|
- 'user_name' => $record->withdraw_account_name
|
|
|
+ 'info_type' => '活动名称',
|
|
|
+ 'info_content' => '用户提现'
|
|
|
+ ],
|
|
|
+ [
|
|
|
+ 'info_type' => '奖励说明',
|
|
|
+ 'info_content' => '余额提现'
|
|
|
]
|
|
|
]
|
|
|
]);
|
|
@@ -290,17 +292,17 @@ class WalletWithdrawRecordService
|
|
|
'result' => $result
|
|
|
]);
|
|
|
|
|
|
- // 检查批次处理状态
|
|
|
- if (isset($result['batch_id'])) {
|
|
|
+ // 检查转账状态
|
|
|
+ if (isset($result['bill_id'])) {
|
|
|
Log::info('微信转账成功', [
|
|
|
'withdraw_id' => $record->id,
|
|
|
- 'batch_id' => $result['batch_id'],
|
|
|
- 'out_batch_no' => $outTradeNo
|
|
|
+ 'bill_id' => $result['bill_id'],
|
|
|
+ 'out_bill_no' => $outTradeNo
|
|
|
]);
|
|
|
|
|
|
return [
|
|
|
'success' => true,
|
|
|
- 'trade_no' => $result['batch_id'],
|
|
|
+ 'trade_no' => $result['bill_id'],
|
|
|
'message' => '微信转账成功'
|
|
|
];
|
|
|
}
|