transfer
This commit is contained in:
parent
1e6efdcd80
commit
7b84fb3b89
@ -111,40 +111,40 @@ class WechatPayService
|
|||||||
|
|
||||||
public function transferBatches(string $trade_no, string $trade_no2, string $openid, int $amount, string $remark): array
|
public function transferBatches(string $trade_no, string $trade_no2, string $openid, int $amount, string $remark): array
|
||||||
{
|
{
|
||||||
try {
|
// try {
|
||||||
$appid = config("wechat.official_account.default.app_id");
|
$appid = config("wechat.official_account.default.app_id");
|
||||||
$data = [
|
$data = [
|
||||||
"appid" => $appid,
|
"appid" => $appid,
|
||||||
"out_bill_no" => $trade_no,
|
"out_bill_no" => $trade_no,
|
||||||
"batch_name" => $remark,
|
"batch_name" => $remark,
|
||||||
"batch_remark" => $remark,
|
"batch_remark" => $remark,
|
||||||
"total_amount" => $amount,
|
"total_amount" => $amount,
|
||||||
"total_num" => 1,
|
"total_num" => 1,
|
||||||
"transfer_detail_list" => [
|
"transfer_detail_list" => [
|
||||||
"out_detail_no" => $trade_no2,
|
"out_detail_no" => $trade_no2,
|
||||||
"transfer_amount" => $amount,
|
"transfer_amount" => $amount,
|
||||||
"transfer_remark" => $remark,
|
"transfer_remark" => $remark,
|
||||||
"openid" => $openid,
|
"openid" => $openid,
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
Log::info("转账到零钱数据", $data);
|
Log::info("转账到零钱数据", $data);
|
||||||
$instance = $this->newClient();
|
$instance = $this->newClient();
|
||||||
$resp = $instance->chain('v3/transfer/batches')->post([
|
$resp = $instance->chain('v3/transfer/batches')->post([
|
||||||
"json" => $data
|
"json" => $data
|
||||||
]);
|
]);
|
||||||
$res = json_decode($resp->getBody(), true);
|
$res = json_decode($resp->getBody(), true);
|
||||||
dd($res);
|
dd($res);
|
||||||
} catch (\Exception $e) {
|
// } catch (\Exception $e) {
|
||||||
// 进行异常捕获并进行错误判断处理
|
// // 进行异常捕获并进行错误判断处理
|
||||||
Log::info($e->getMessage());
|
// Log::info($e->getMessage());
|
||||||
if ($e instanceof \GuzzleHttp\Exception\RequestException && $e->hasResponse()) {
|
// if ($e instanceof \GuzzleHttp\Exception\RequestException && $e->hasResponse()) {
|
||||||
$r = $e->getResponse();
|
// $r = $e->getResponse();
|
||||||
$res = json_decode($r->getBody());
|
// $res = json_decode($r->getBody());
|
||||||
return ["code" => 1, "err_msg" => $r->getBody()];
|
// return ["code" => 1, "err_msg" => $r->getBody()];
|
||||||
}
|
// }
|
||||||
|
|
||||||
return ["code" => 1, "err_msg" => $e->getMessage()];
|
// return ["code" => 1, "err_msg" => $e->getMessage()];
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user