diff --git a/wchat/qq/Account.php b/wchat/qq/Account.php index 624af4d..e5ac295 100644 --- a/wchat/qq/Account.php +++ b/wchat/qq/Account.php @@ -30,6 +30,7 @@ class Account extends SmallProgram } $this->request->setHost('api.q.qq.com'); + $this->request->addHeader('Host', 'api.q.qq.com'); $this->request->setMethod(HttpClient::GET); $this->request->setIsSSL(true); $this->request->setUseSwoole($this->config->isUsrSwoole()); diff --git a/wchat/qq/QrCode.php b/wchat/qq/QrCode.php deleted file mode 100644 index a250644..0000000 --- a/wchat/qq/QrCode.php +++ /dev/null @@ -1,117 +0,0 @@ -savePath = $path; - } - - - /** - * @param $path - * @param $width - * @return array|mixed|Result - * @throws \Exception - */ - public function createwxaqrcode($path, $width) - { - $url = $this->wxaqr . $this->getAccessToken(); - - $sendBody['path'] = $path; - $sendBody['width'] = $width; - - $this->request->setMethod(HttpClient::POST); - $this->request->setCallback([$this, 'saveByPath']); - - return $this->request->post($url, $sendBody); - } - - - /** - * @param $path - * @param $width - * @param bool $is_hyaline - * @param bool $auto_color - * @param string $line_color - * @return array|mixed|Result - * @throws \Exception - */ - public function getwxacode($path, $width, $is_hyaline = false, $auto_color = false, $line_color = '') - { - $sendBody['path'] = $path; - $sendBody['width'] = $width; - $sendBody['auto_color'] = $auto_color; - $sendBody['is_hyaline'] = $is_hyaline; - if ($auto_color) { - $sendBody['line_color'] = $line_color; - } - - $url = $this->getwxacode . $this->getAccessToken(); - - $this->request->setMethod(HttpClient::POST); - $this->request->setCallback([$this, 'saveByPath']); - return $this->request->post($url, $sendBody); - } - - - /** - * @param $path - * @param $width - * @param bool $is_hyaline - * @param bool $auto_color - * @param string $line_color - * @return array|mixed|Result - * @throws \Exception - */ - public function getwxacodeunlimit($path, $width, $is_hyaline = false, $auto_color = false, $line_color = '') - { - $sendBody['path'] = $path; - $sendBody['width'] = $width; - $sendBody['auto_color'] = $auto_color; - $sendBody['is_hyaline'] = $is_hyaline; - if ($auto_color) { - $sendBody['line_color'] = $line_color; - } - - $url = $this->getwxacodeunlimit . $this->getAccessToken(); - - $this->request->setMethod(HttpClient::POST); - $this->request->setCallback([$this, 'saveByPath']); - return $this->request->post($url, $sendBody); - } - - /** - * @param mixed $body - * @return string - * @throws \Exception - */ - public function saveByPath($body) - { - if (!is_null($json = json_decode($body))) { - throw new \Exception($json['errmsg'], $json['errcode']); - } - - $push = md5_file($body) . '.png'; - file_put_contents($this->savePath . $push, $this->savePath); - return $this->savePath . $push; - } -} diff --git a/wchat/qq/Subject.php b/wchat/qq/Subject.php index 210bdcf..4202fe7 100644 --- a/wchat/qq/Subject.php +++ b/wchat/qq/Subject.php @@ -20,7 +20,7 @@ class Subject extends \wchat\base\Subject */ public function getUrl(): string { - return $this->getUrl(); + return $this->sendUrl; } }