From c5ff92f77887c69e2d04a139f5d0c297b951f65a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Tue, 2 May 2023 21:17:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=81=E4=B8=9A=E6=89=93=E6=AC=BE=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=A4=A7=E4=BA=8E2000=E7=9A=84RSA=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E5=8A=A0=E5=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WePayV3/Contracts/BasicWePay.php | 7 +++++-- WePayV3/Transfers.php | 8 +++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/WePayV3/Contracts/BasicWePay.php b/WePayV3/Contracts/BasicWePay.php index fc81575..82548f9 100644 --- a/WePayV3/Contracts/BasicWePay.php +++ b/WePayV3/Contracts/BasicWePay.php @@ -157,8 +157,11 @@ abstract class BasicWePay $location = (preg_match('|^https?://|', $pathinfo) ? '' : $this->base) . $pathinfo; list($header, $content) = $this->_doRequestCurl($method, $location, [ 'data' => $jsondata, 'header' => [ - "Accept: application/json", "Content-Type: application/json", - 'User-Agent: https://thinkadmin.top', "Authorization: WECHATPAY2-SHA256-RSA2048 {$token}", + 'Accept: application/json', + 'Content-Type: application/json', + 'User-Agent: https://thinkadmin.top', + "Authorization: WECHATPAY2-SHA256-RSA2048 {$token}", + "Wechatpay-Serial: {$this->config['cert_serial']}" ], ]); diff --git a/WePayV3/Transfers.php b/WePayV3/Transfers.php index 30ac5e7..0d75b49 100644 --- a/WePayV3/Transfers.php +++ b/WePayV3/Transfers.php @@ -20,7 +20,7 @@ use WePayV3\Contracts\BasicWePay; /** * 普通商户商家转账到零钱 - * Class Transfers + * @class Transfers * @package WePayV3 */ class Transfers extends BasicWePay @@ -29,10 +29,16 @@ class Transfers extends BasicWePay * 发起商家批量转账 * @param array $body * @return array + * @throws \WeChat\Exceptions\InvalidDecryptException * @throws \WeChat\Exceptions\InvalidResponseException */ public function batchs($body) { + if (isset($body['transfer_detail_list']) && is_array($body['transfer_detail_list'])) { + foreach ($body['transfer_detail_list'] as &$item) if (isset($item['user_name'])) { + $item['user_name'] = $this->rsaEncode($item['user_name']); + } + } return $this->doRequest('POST', '/v3/transfer/batches', json_encode($body, JSON_UNESCAPED_UNICODE), true); }