add clear
This commit is contained in:
+2
-2
@@ -15,7 +15,7 @@ class Account extends Base
|
||||
*/
|
||||
public function login($code)
|
||||
{
|
||||
return Http::get('sns/jscode2session', [
|
||||
return WxClient::get('sns/jscode2session', [
|
||||
'appid' => $this->appid,
|
||||
'secret' => $this->appsecret,
|
||||
'js_code' => $code,
|
||||
@@ -24,4 +24,4 @@ class Account extends Base
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -155,7 +155,7 @@ abstract class Base
|
||||
*/
|
||||
public function push($url, $data = [], callable $callback = NULL)
|
||||
{
|
||||
return Http::post($url, $data, $callback);
|
||||
return WxClient::post($url, $data, $callback);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -246,7 +246,7 @@ abstract class Base
|
||||
*/
|
||||
protected function getAccessToken()
|
||||
{
|
||||
$data = Http::get('https://api.weixin.qq.com/cgi-bin/token', [
|
||||
$data = WxClient::get('https://api.weixin.qq.com/cgi-bin/token', [
|
||||
'grant_type' => 'client_credential',
|
||||
'appid' => $this->appid,
|
||||
'secret' => $this->appsecret,
|
||||
|
||||
+2
-2
@@ -34,7 +34,7 @@ class Recharge extends Base
|
||||
$this->money = $money;
|
||||
$this->orderNo = $orderNo;
|
||||
$this->data['openid'] = $openId;
|
||||
return Http::post($this->createPayUrl(), $this->builder(),
|
||||
return WxClient::post($this->createPayUrl(), $this->builder(),
|
||||
function ($result, $body) use ($_this) {
|
||||
$data = $_this->toArray($result);
|
||||
if (isset($data['sign'])) {
|
||||
@@ -120,7 +120,7 @@ class Recharge extends Base
|
||||
|
||||
$array['sign'] = $this->sign($array);
|
||||
|
||||
return Http::post($transfers, static::toXml($array), function ($data) {
|
||||
return WxClient::post($transfers, static::toXml($array), function ($data) {
|
||||
$array = $this->toArray($data);
|
||||
if ($array['result_code'] != 'SUCCESS') {
|
||||
$data = ['code' => $array['err_code'], 'message' => $array['err_code_des']];
|
||||
|
||||
+2
-2
@@ -24,7 +24,7 @@ class Template extends Base
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token=' . $access;
|
||||
$postBody = json_encode($postBody);
|
||||
return Http::post($url, $postBody, NULL, ['content-type' => 'application/json'])
|
||||
return WxClient::post($url, $postBody, NULL, ['content-type' => 'application/json'])
|
||||
->append('postBody', $postBody);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace wchat;
|
||||
|
||||
use Swoole\Coroutine\Http\Client;
|
||||
|
||||
class Http
|
||||
class WxClient
|
||||
{
|
||||
private $url = 'api.weixin.qq.com';
|
||||
|
||||
@@ -205,7 +205,7 @@ class Http
|
||||
public static function post($url, $data = [], callable $callback = NULL, array $header = NULL, $isSSl = FALSE)
|
||||
{
|
||||
static $_class = NULL;
|
||||
if ($_class == NULL) $_class = new Http();
|
||||
if ($_class == NULL) $_class = new WxClient();
|
||||
if (!empty($header)) $_class->setHeaders($header);
|
||||
return $_class->request($url, 'post', $data, $callback, $isSSl);
|
||||
}
|
||||
@@ -223,7 +223,7 @@ class Http
|
||||
public static function put($url, $data = [], callable $callback = NULL, array $header = NULL, $isSSl = FALSE)
|
||||
{
|
||||
static $_class = NULL;
|
||||
if ($_class == NULL) $_class = new Http();
|
||||
if ($_class == NULL) $_class = new WxClient();
|
||||
if (!empty($header)) $_class->setHeaders($header);
|
||||
return $_class->request($url, 'put', $data, $callback, $isSSl);
|
||||
}
|
||||
@@ -239,7 +239,7 @@ class Http
|
||||
public static function get($url, $data = [], callable $callback = NULL, $header = [])
|
||||
{
|
||||
static $_class = NULL;
|
||||
if ($_class == NULL) $_class = new Http();
|
||||
if ($_class == NULL) $_class = new WxClient();
|
||||
if (!empty($header)) $_class->setHeaders($header);
|
||||
return $_class->request($url, 'get', $data, $callback);
|
||||
}
|
||||
@@ -254,7 +254,7 @@ class Http
|
||||
public static function option($url, $data = [], $header = [])
|
||||
{
|
||||
static $_class = NULL;
|
||||
if ($_class == NULL) $_class = new Http();
|
||||
if ($_class == NULL) $_class = new WxClient();
|
||||
if (!empty($header)) $_class->setHeaders($header);
|
||||
return $_class->request($url, 'option', $data);
|
||||
}
|
||||
@@ -269,7 +269,7 @@ class Http
|
||||
public static function delete($url, $data = [], $header = [])
|
||||
{
|
||||
static $_class = NULL;
|
||||
if ($_class == NULL) $_class = new Http();
|
||||
if ($_class == NULL) $_class = new WxClient();
|
||||
if (!empty($header)) $_class->setHeaders($header);
|
||||
return $_class->request($url, 'delete', $data);
|
||||
}
|
||||
Reference in New Issue
Block a user