add clear

This commit is contained in:
2020-09-10 17:25:46 +08:00
parent 0d202fce14
commit c0ab8adfcb
9 changed files with 60 additions and 10 deletions
+14 -1
View File
@@ -4,9 +4,22 @@
namespace wchat\officialaccount;
use wchat\base\Access_Token;
use wchat\common\HttpClient;
class AccessToken extends AfficialAccount
class AccessToken extends AfficialAccount implements Access_Token
{
/**
* @param false $get_token
* @return mixed
* @throws \Exception
*/
public function generateAccess_token($get_token = false)
{
return parent::generateAccess_token($get_token); // TODO: Change the autogenerated stub
}
}
+8 -2
View File
@@ -14,10 +14,11 @@ abstract class AfficialAccount extends Miniprogarampage
private $url = 'https://api.weixin.qq.com/cgi-bin/token?';
/**
* @param bool $get_token
* @return mixed
* @throws
* @throws \Exception
*/
public function generateAccess_token()
public function generateAccess_token($get_token = false)
{
if (!empty($this->config->getToken())) {
return $this->config->getToken();
@@ -30,6 +31,11 @@ abstract class AfficialAccount extends Miniprogarampage
if (!$result->isResultsOK()) {
throw new \Exception($result->getMessage(), $result->getCode());
}
if ($get_token) {
return $result->getData('access_token');
}
return $result->getData();
}
+1 -1
View File
@@ -27,7 +27,7 @@ class Authorization extends AfficialAccount
/**
* @param $code
* @return array|mixed|Result
* @return Result
* @throws Exception
*/
public function authorization_user_info($code)