14 Commits

Author SHA1 Message Date
as2252258 b87232bbc0 Default Changelist 2023-11-07 13:48:18 +08:00
as2252258 d9528679ff Default Changelist 2023-11-07 13:48:04 +08:00
as2252258 09544ee4a2 Default Changelist 2023-08-18 20:24:15 +08:00
as2252258 a7c6939a9f Default Changelist 2023-08-18 19:59:46 +08:00
as2252258 0578ba384b Default Changelist 2023-08-18 19:58:45 +08:00
as2252258 7abbaaca46 Default Changelist 2023-08-18 19:50:25 +08:00
as2252258 d574ce2c42 Default Changelist 2023-08-18 19:47:48 +08:00
as2252258 2275ed92d1 Default Changelist 2023-08-18 17:47:42 +08:00
as2252258 48467b88ce Default Changelist 2023-08-18 17:40:46 +08:00
as2252258 e87728266b Default Changelist 2023-08-18 16:59:47 +08:00
as2252258 ae67dce77b Default Changelist 2023-08-18 16:58:36 +08:00
as2252258 2ff7ceb66b Default Changelist 2023-08-18 16:57:32 +08:00
as2252258 c74c3b004b Default Changelist 2023-08-18 15:34:49 +08:00
as2252258 b92ea7df9f Default Changelist 2023-08-18 15:31:47 +08:00
23 changed files with 177 additions and 259 deletions
+1
View File
@@ -1,3 +1,4 @@
/.idea/php.xml
vendor/
composer.lock
.idea/*
+1 -1
View File
@@ -21,8 +21,8 @@
},
"require": {
"php": ">= 8.0",
"game-worker/kiri-client": "~v2.6",
"game-worker/kiri-container": "~v1.9",
"game-worker/kiri-client": "~v2.8",
"psr/container": "*"
},
"require-dev": {
+1 -1
View File
@@ -166,7 +166,7 @@ abstract class Subject extends Multiprogramming
$client->close();
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: 'network error.');
return new Result(code: 505, message: $client->getBody());
}
$body = json_decode($client->getBody(), true);
if (isset($body['errcode']) && $body['errcode'] != 0) {
+1 -1
View File
@@ -137,7 +137,7 @@ abstract class Template extends Multiprogramming
$client->close();
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: 'network error.');
return new Result(code: 505, message: $client->getBody());
}
$body = json_decode($client->getBody(), true);
if (isset($body['errcode']) && $body['errcode'] != 0) {
+1 -1
View File
@@ -57,7 +57,7 @@ class Result
public static function init(Client $client): static
{
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: 'network error.');
return new Result(code: 505, message: $client->getBody());
}
$body = json_decode($client->getBody(), true);
if (isset($body['errcode']) && $body['errcode'] != 0) {
+80 -81
View File
@@ -10,107 +10,106 @@ namespace wchat\qq;
use Exception;
use Kiri\Client;
use wchat\common\HttpClient;
use wchat\common\Result;
use wchat\common\Help;
class Recharge extends SmallProgram
{
private $money = 0;
private float $money = 0;
private $orderNo;
private string $orderNo;
private $data = [];
private array $data = [];
private $spill_create_ip = '';
private string $spill_create_ip = '';
private $uniformer = 'https://qpay.qq.com/cgi-bin/pay/qpay_unified_order.cgi';
private string $uniformer = '/cgi-bin/pay/qpay_unified_order.cgi';
/**
* @param $value
*/
public function setSpillCreateIp($value)
{
$this->spill_create_ip = $value;
}
/**
* @param $value
*/
public function setSpillCreateIp($value)
{
$this->spill_create_ip = $value;
}
/**
* @param int $money
* @param string $orderNo
* @param string $openId
* @return Result
* @throws
*/
public function recharge(int $money, string $orderNo, string $openId = ''): Result
{
if ($money < 0) {
return new Result(code: 500, message: '充值金额不能小于0.');
}
$this->money = $money;
$this->orderNo = $orderNo;
$this->data['openid'] = $openId;
/**
* @param int $money
* @param string $orderNo
* @param string $openId
* @return Result
* @throws
*/
public function recharge(int $money, string $orderNo, string $openId = ''): Result
{
if ($money < 0) {
return new Result(code: 500, message: '充值金额不能小于0.');
}
$this->money = $money;
$this->orderNo = $orderNo;
$this->data['openid'] = $openId;
$client = new Client('qpay.qq.com', 443, true);
$client->withHeader(['Content-Type' => 'application/xml']);
$client->withBody($this->builder());
$client->post($this->uniformer);
$client->close();
$client = new Client('qpay.qq.com', 443, true);
$client->withHeader(['Content-Type' => 'application/xml']);
$client->withBody($this->builder());
$client->post($this->uniformer);
$client->close();
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: 'network error.');
}
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: $client->getBody());
}
$data = Help::toArray($client->getBody());
if (isset($data['return_code']) && $data['return_code'] != 'SUCCESS') {
return new Result(code: 503, message: $data['return_msg']);
}
if ($data['result_code'] != 'SUCCESS') {
return new Result(code: 504, message: $data['err_code_des']);
}
$data = Help::toArray($client->getBody());
if (isset($data['return_code']) && $data['return_code'] != 'SUCCESS') {
return new Result(code: 503, message: $data['return_msg']);
}
if ($data['result_code'] != 'SUCCESS') {
return new Result(code: 504, message: $data['err_code_des']);
}
return new Result(code: 0, data: $this->reception($data['prepayid']));
}
return new Result(code: 0, data: $this->reception($data['prepayid']));
}
/**
* @param string $prepay_id
* @return string
*/
public function reception(string $prepay_id): string
{
return Help::sign([
'signType' => $this->config->getSignType(),
'package' => 'prepay_id=' . $prepay_id,
'nonceStr' => Help::random(32),
'timestamp' => time()
], $this->getConfig()->getKey(), $this->getConfig()->getSignType());
}
/**
* @param string $prepay_id
* @return string
*/
public function reception(string $prepay_id): string
{
return Help::sign([
'signType' => $this->config->getSignType(),
'package' => 'prepay_id=' . $prepay_id,
'nonceStr' => Help::random(32),
'timestamp' => time()
], $this->getConfig()->getKey(), $this->getConfig()->getSignType());
}
/**
* @return string
*/
protected function builder(): string
{
$data = [
'appid' => $this->config->getAppid(),
'mch_id' => $this->config->getMchId(),
'nonce_str' => Help::random(32),
'body' => $this->config->getBody(),
'out_trade_no' => $this->orderNo,
'total_fee' => $this->money,
'spbill_create_ip' => $this->spill_create_ip,
'notify_url' => $this->config->getNotifyUrl(),
'trade_type' => $this->config->getTradeType(),
];
/**
* @return string
*/
protected function builder(): string
{
$data = [
'appid' => $this->config->getAppid(),
'mch_id' => $this->config->getMchId(),
'nonce_str' => Help::random(32),
'body' => $this->config->getBody(),
'out_trade_no' => $this->orderNo,
'total_fee' => $this->money,
'spbill_create_ip' => $this->spill_create_ip,
'notify_url' => $this->config->getNotifyUrl(),
'trade_type' => $this->config->getTradeType(),
];
$this->data = array_merge($data, $this->data);
$this->data = array_merge($data, $this->data);
$key = $this->config->getKey();
$sign_type = $this->config->getSignType();
$key = $this->config->getKey();
$sign_type = $this->config->getSignType();
$this->data['sign_type'] = $this->config->getSignType();
$this->data['sign'] = Help::sign($this->data, $key, $sign_type);
$this->data['sign_type'] = $this->config->getSignType();
$this->data['sign'] = Help::sign($this->data, $key, $sign_type);
return Help::toXml($this->data);
}
return Help::toXml($this->data);
}
}
+16 -146
View File
@@ -11,12 +11,9 @@ class Redhat extends SmallProgram
{
private string $charset = 'UTF8';
private string $nonce_str = '';
private string $sign = '';
private string $mch_billno = '';
private string $mch_id = '';
private string $mch_name = '';
private string $qqappid = '';
private string $re_openid = '';
private string $total_amount = '';
private string $total_num = '';
@@ -24,12 +21,9 @@ class Redhat extends SmallProgram
private string $act_name = '';
private string $icon_id = '';
private string $banner_id = '';
private string $notify_url = '';
private string $not_send_msg = '';
private string $min_value = '';
private string $max_value = '';
private string $key = '';
private string $signType = '';
private string $sendUrl = '/cgi-bin/hongbao/qpay_hb_mch_send.cgi';
@@ -51,22 +45,6 @@ class Redhat extends SmallProgram
$this->charset = $charset;
}
/**
* @return string
*/
public function getNonceStr(): string
{
return $this->nonce_str;
}
/**
* @param string $nonce_str
*/
public function setNonceStr(string $nonce_str): void
{
$this->nonce_str = $nonce_str;
}
/**
* @return string
*/
@@ -99,22 +77,6 @@ class Redhat extends SmallProgram
$this->mch_billno = $mch_billno;
}
/**
* @return string
*/
public function getMchId(): string
{
return $this->mch_id;
}
/**
* @param string $mch_id
*/
public function setMchId(string $mch_id): void
{
$this->mch_id = $mch_id;
}
/**
* @return string
*/
@@ -131,21 +93,6 @@ class Redhat extends SmallProgram
$this->mch_name = $mch_name;
}
/**
* @return string
*/
public function getQqappid(): string
{
return $this->qqappid;
}
/**
* @param string $qqappid
*/
public function setQqappid(string $qqappid): void
{
$this->qqappid = $qqappid;
}
/**
* @return string
@@ -259,22 +206,6 @@ class Redhat extends SmallProgram
$this->banner_id = $banner_id;
}
/**
* @return string
*/
public function getNotifyUrl(): string
{
return $this->notify_url;
}
/**
* @param string $notify_url
*/
public function setNotifyUrl(string $notify_url): void
{
$this->notify_url = $notify_url;
}
/**
* @return string
*/
@@ -323,84 +254,20 @@ class Redhat extends SmallProgram
$this->max_value = $max_value;
}
/**
* @return string
*/
public function getKey(): string
{
return $this->key;
}
/**
* @param string $key
*/
public function setKey(string $key): void
{
$this->key = $key;
}
/**
* @return string
*/
public function getSignType(): string
{
return $this->signType;
}
/**
* @param string $signType
*/
public function setSignType(string $signType): void
{
$this->signType = $signType;
}
/**
* @return string
*/
public function getSendUrl(): string
{
return $this->sendUrl;
}
/**
* @param string $sendUrl
*/
public function setSendUrl(string $sendUrl): void
{
$this->sendUrl = $sendUrl;
}
/**
* @return string
*/
public function getSearchUrl(): string
{
return $this->searchUrl;
}
/**
* @param string $searchUrl
*/
public function setSearchUrl(string $searchUrl): void
{
$this->searchUrl = $searchUrl;
}
/**
* @return mixed
* 构建请求参数
*/
private function generate(): array
public function generate(): array
{
$requestParam = [];
$requestParam['charset'] = $this->getCharset();
$requestParam['nonce_str'] = $this->getNonceStr();
$requestParam['nonce_str'] = Help::random(30);
$requestParam['mch_billno'] = $this->getMchBillno();
$requestParam['mch_id'] = $this->getMchId();
$requestParam['mch_id'] = $this->config->getMchId();
$requestParam['mch_name'] = $this->getMchName();
$requestParam['qqappid'] = $this->getQqappid();
$requestParam['qqappid'] = $this->config->getAppid();
$requestParam['re_openid'] = $this->getReOpenid();
$requestParam['total_amount'] = $this->getTotalAmount() * 100;
$requestParam['min_value'] = $this->getMinValue() * 100;
@@ -409,7 +276,7 @@ class Redhat extends SmallProgram
$requestParam['wishing'] = $this->getWishing();
$requestParam['act_name'] = $this->getActName();
$requestParam['icon_id'] = $this->getIconId();
$requestParam['notify_url'] = $this->getNotifyUrl();
$requestParam['notify_url'] = $this->config->getNotifyUrl();
$requestParam['sign'] = $this->builderSign($requestParam);
@@ -423,7 +290,7 @@ class Redhat extends SmallProgram
*/
private function builderSign($requestParam): string
{
return Help::sign($requestParam, $this->getKey(), $this->getSignType());
return Help::sign($requestParam, $this->config->getKey(), $this->config->getSignType());
}
/**
@@ -431,12 +298,15 @@ class Redhat extends SmallProgram
*/
public function redEnvelopes(): Result
{
$client = new Client('qpay.qq.com', 443, true);
$client->withHeader(['Content-Type' => 'application/json']);
$client->post($this->sendUrl, $this->generate());
$client = new Client('api.qpay.qq.com', 443, true);
$client->withHeader(['Content-Type' => 'application/x-www-form-urlencoded']);
$client->withSslKeyFile($this->config->getSslKey());
$client->withSslCertFile($this->config->getSslCert());
$client->withCa($this->config->getSslCa());
$client->post($this->sendUrl, http_build_query($this->generate()));
$client->close();
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: 'network error.');
return new Result(code: 505, message: $client->getBody());
}
$json = json_decode($client->getBody(), true);
if (isset($json['return_code']) && $json['return_code'] != 'SUCCESS') {
@@ -457,8 +327,8 @@ class Redhat extends SmallProgram
*/
public function searchByOrderNo($listid, $orderNo = null): Result
{
$requestParam['nonce_str'] = $this->getNonceStr();
$requestParam['mch_id'] = $this->getMchId();
$requestParam['nonce_str'] = Help::random(31);
$requestParam['mch_id'] = $this->config->getMchId();
$requestParam['listid'] = $listid;
if (!empty($orderNo)) {
$requestParam['mch_billno'] = $orderNo;
@@ -469,7 +339,7 @@ class Redhat extends SmallProgram
$client->post($this->searchUrl, $requestParam);
$client->close();
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: 'network error.');
return new Result(code: 505, message: $client->getBody());
}
$json = json_decode($client->getBody(), true);
if (isset($json['result']) && $json['result'] != 'SUCCESS') {
+2 -2
View File
@@ -40,7 +40,7 @@ class SecCheck extends SmallProgram
$client->upload($path, $data);
$client->close();
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: 'network error.');
return new Result(code: 505, message: $client->getBody());
}
$body = json_decode($client->getBody(), true);
if (isset($body['errCode']) && $body['errCode'] != 0) {
@@ -68,7 +68,7 @@ class SecCheck extends SmallProgram
$client->close();
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: 'network error.');
return new Result(code: 505, message: $client->getBody());
}
$body = json_decode($client->getBody(), true);
if (isset($body['errCode']) && $body['errCode'] != 0) {
+1 -1
View File
@@ -25,7 +25,7 @@ class Token extends SmallProgram
$client->get('/api/getToken', $query);
$client->close();
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: 'network error.');
return new Result(code: 505, message: $client->getBody());
}
$body = json_decode($client->getBody(), true);
if (isset($body['errcode']) && $body['errcode'] != 0) {
+1 -1
View File
@@ -94,7 +94,7 @@ class Cash_Bonus extends SmallProgram
$client->post($this->_cash, $this->orderConfig($mch_billno, $openId, $price));
$client->close();
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: 'network error.');
return new Result(code: 505, message: $client->getBody());
}
$json = json_decode($client->getBody(), true);
+1 -1
View File
@@ -80,7 +80,7 @@ class Enterprise_payment extends SmallProgram
$client->post($this->_cash, $this->orderConfig($mch_billno, $openId, $price));
$client->close();
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: 'network error.');
return new Result(code: 505, message: $client->getBody());
}
$json = json_decode($client->getBody(), true);
if (isset($json['return_code']) && $json['return_code'] != 'SUCCESS') {
+5 -5
View File
@@ -34,7 +34,7 @@ class Account extends SmallProgram
$client->close();
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: 'network error.');
return new Result(code: 505, message: $client->getBody());
}
$body = json_decode($client->getBody(), true);
if (isset($body['errcode']) && $body['errcode'] != 0) {
@@ -63,7 +63,7 @@ class Account extends SmallProgram
$client->close();
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: 'network error.');
return new Result(code: 505, message: $client->getBody());
}
$body = json_decode($client->getBody(), true);
if (isset($body['errcode']) && $body['errcode'] != 0) {
@@ -115,7 +115,7 @@ class Account extends SmallProgram
$client->post($url . $this->getConfig()->getAccessToken(), $sendBody);
$client->close();
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: 'network error.');
return new Result(code: 505, message: $client->getBody());
}
$body = json_decode($client->getBody(), true);
if (!is_null($body)) {
@@ -151,7 +151,7 @@ class Account extends SmallProgram
$client->post($url . $this->getConfig()->getAccessToken(), $sendBody);
$client->close();
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: 'network error.');
return new Result(code: 505, message: $client->getBody());
}
$body = json_decode($client->getBody(), true);
if (!is_null($body)) {
@@ -187,7 +187,7 @@ class Account extends SmallProgram
$client->post($url . $this->getConfig()->getAccessToken(), $sendBody);
$client->close();
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: 'network error.');
return new Result(code: 505, message: $client->getBody());
}
$body = json_decode($client->getBody(), true);
if (!is_null($body)) {
+2 -2
View File
@@ -267,7 +267,7 @@ class Message extends SmallProgram
$this->msgData = [];
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: 'network error.');
return new Result(code: 505, message: $client->getBody());
}
$body = json_decode($client->getBody(), true);
if (isset($body['errcode']) && $body['errcode'] != 0) {
@@ -303,7 +303,7 @@ class Message extends SmallProgram
$this->msgData = [];
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: 'network error.');
return new Result(code: 505, message: $client->getBody());
}
$body = json_decode($client->getBody(), true);
if (isset($body['errcode']) && $body['errcode'] != 0) {
+1 -1
View File
@@ -152,7 +152,7 @@ class PublicTemplate extends SmallProgram
$client->close();
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: 'network error.');
return new Result(code: 505, message: $client->getBody());
}
$body = json_decode($client->getBody(), true);
if (isset($body['errcode']) && $body['errcode'] != 0) {
+3 -3
View File
@@ -42,7 +42,7 @@ class SecCheck extends SmallProgram
$client->close();
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: 'network error.');
return new Result(code: 505, message: $client->getBody());
}
$body = json_decode($client->getBody(), true);
if (isset($body['errcode']) && $body['errcode'] != 0) {
@@ -70,7 +70,7 @@ class SecCheck extends SmallProgram
$client->close();
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: 'network error.');
return new Result(code: 505, message: $client->getBody());
}
$body = json_decode($client->getBody(), true);
if (isset($body['errcode']) && $body['errcode'] != 0) {
@@ -108,7 +108,7 @@ class SecCheck extends SmallProgram
$client->close();
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: 'network error.');
return new Result(code: 505, message: $client->getBody());
}
$body = json_decode($client->getBody(), true);
if (isset($body['errcode']) && $body['errcode'] != 0) {
+1 -1
View File
@@ -25,7 +25,7 @@ class Token extends SmallProgram
$client->get('cgi-bin/token', $query);
$client->close();
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: 'network error.');
return new Result(code: 505, message: $client->getBody());
}
$body = json_decode($client->getBody(), true);
if (isset($body['errcode']) && $body['errcode'] != 0) {
+1 -1
View File
@@ -39,7 +39,7 @@ class WxV2AppPayment extends SmallProgram
$client->close();
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: 'network error.');
return new Result(code: 505, message: $client->getBody());
}
$data = Help::toArray($client->getBody());
if (isset($data['return_code']) && $data['return_code'] != 'SUCCESS') {
+4 -4
View File
@@ -41,7 +41,7 @@ class WxV2PayJsApi extends SmallProgram
$client->close();
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: 'network error.');
return new Result(code: 505, message: $client->getBody());
}
$data = Help::toArray($client->getBody());
if (isset($data['return_code']) && $data['return_code'] != 'SUCCESS') {
@@ -87,7 +87,7 @@ class WxV2PayJsApi extends SmallProgram
$client->close();
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: 'network error.');
return new Result(code: 505, message: $client->getBody());
}
$data = Help::toArray($client->getBody());
if (isset($data['return_code']) && $data['return_code'] != 'SUCCESS') {
@@ -133,7 +133,7 @@ class WxV2PayJsApi extends SmallProgram
$client->close();
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: 'network error.');
return new Result(code: 505, message: $client->getBody());
}
$data = Help::toArray($client->getBody());
if (isset($data['return_code']) && $data['return_code'] != 'SUCCESS') {
@@ -179,7 +179,7 @@ class WxV2PayJsApi extends SmallProgram
$client->close();
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: 'network error.');
return new Result(code: 505, message: $client->getBody());
}
$data = Help::toArray($client->getBody());
if (isset($data['return_code']) && $data['return_code'] != 'SUCCESS') {
+1 -1
View File
@@ -44,7 +44,7 @@ class WxV2Withdrawal extends SmallProgram
$client->close();
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: 'network error.');
return new Result(code: 505, message: $client->getBody());
}
$data = Help::toArray($client->getBody());
+50
View File
@@ -0,0 +1,50 @@
<?php
namespace wchat\wx\V3;
use Exception;
use JetBrains\PhpStorm\ArrayShape;
use Kiri\Client;
use wchat\wx\SmallProgram;
class TransferBatches extends SmallProgram
{
use WxV3PaymentTait;
/**
* @param string $orderNo
* @param int $total
* @param string $openId
* @return array
* @throws Exception
*/
#[ArrayShape(['code_url' => "string"])]
public function request(string $orderNo, int $total, string $openId): array
{
$body['appid'] = $this->getConfig()->getAppid();
$body['out_trade_no'] = $orderNo;
$body["batch_name"] = $this->getConfig()->getBody();
$body["batch_remark"] = $this->getConfig()->getBody();
$body["total_amount"] = $total;
$body["total_num"] = 1;
$body["transfer_detail_list"] = [
[
"out_detail_no" => $orderNo,
"transfer_amount" => $total,
"transfer_remark" => $this->getConfig()->getBody(),
"openid" => $openId,
]
];
$sign = $this->signature('POST', '/v3/transfer/batches', $json = json_encode($body, JSON_UNESCAPED_UNICODE));
$client = new Client('api.mch.weixin.qq.com', 443, TRUE);
$client->withAddedHeader('Authorization', $sign)->withContentType('application/json')
->withAgent('application/json')->withBody($json)
->post('/v3/transfer/batches');
$client->close();
return json_decode($client->getBody(), TRUE);
}
}
+1 -2
View File
@@ -4,7 +4,6 @@ namespace wchat\wx\V3;
use Exception;
use Kiri\Client;
use Kiri\Message\Stream;
use JetBrains\PhpStorm\ArrayShape;
use wchat\wx\SmallProgram;
@@ -32,7 +31,7 @@ class WxV3NativePayment extends SmallProgram
$client = new Client('api.mch.weixin.qq.com', 443, TRUE);
$client->withAddedHeader('Authorization', $sign)->withContentType('application/json')
->withAgent('application/json')->withBody(new Stream($json))
->withAgent('application/json')->withBody($json)
->post('/v3/pay/transactions/native');
$client->close();
+1 -2
View File
@@ -4,7 +4,6 @@ namespace wchat\wx\V3;
use Exception;
use Kiri\Client;
use Kiri\Message\Stream;
use wchat\wx\SmallProgram;
class WxV3Payment extends SmallProgram
@@ -34,7 +33,7 @@ class WxV3Payment extends SmallProgram
$client->withAddedHeader('Authorization', $sign)
->withContentType('application/json')
->withAddedHeader('User-Agent', 'application/json')
->withBody(new Stream($json))
->withBody($json)
->post('/v3/pay/transactions/jsapi');
$client->close();
+1 -1
View File
@@ -33,7 +33,7 @@ class WxV3Withdrawal extends SmallProgram
$client->withAddedHeader('Authorization', $sign)
->withContentType('application/json')
->withAddedHeader('User-Agent', 'application/json')
->withBody(new Stream($json))
->withBody($json)
->post('/v3/pay/transactions/batches');
$client->close();