add clear

This commit is contained in:
2022-09-09 16:42:55 +08:00
parent ad76b45b45
commit 7273fe1ce5
63 changed files with 2625 additions and 5287 deletions
+2 -35
View File
@@ -4,41 +4,8 @@
namespace wchat\wx;
use wchat\common\Miniprogarampage;
use wchat\common\Multiprogramming;
class SmallProgram extends Miniprogarampage
class SmallProgram extends Multiprogramming
{
protected static $instance;
private $url = 'https://api.weixin.qq.com/cgi-bin/token';
/**
* @param bool $get_token
* @return mixed
* @throws \Exception
*/
public function generateAccess_token($get_token = false)
{
if (!empty($this->config->getToken())) {
return $this->config->getToken();
}
$query = [
'grant_type' => 'client_credential',
'appid' => $this->config->getAppid(),
'secret' => $this->config->getAppsecret()
];
$this->request->setErrorField('errcode');
$this->request->setErrorMsgField('errmsg');
$param = $this->request->get($this->url, $query);
if (!$param->isResultsOK()) {
throw new \Exception($param->getMessage());
}
if ($get_token) {
return $param->getData('access_token');
}
return $param->getData();
}
}