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
+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();
}