Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 09544ee4a2 | |||
| a7c6939a9f | |||
| 0578ba384b | |||
| 7abbaaca46 | |||
| d574ce2c42 | |||
| 2275ed92d1 | |||
| 48467b88ce | |||
| e87728266b | |||
| ae67dce77b | |||
| 2ff7ceb66b | |||
| c74c3b004b | |||
| b92ea7df9f |
+1
-1
@@ -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": {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
@@ -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
@@ -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') {
|
||||
|
||||
@@ -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
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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') {
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
@@ -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) {
|
||||
|
||||
@@ -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') {
|
||||
|
||||
@@ -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') {
|
||||
|
||||
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user