add clear

This commit is contained in:
as2252258@163.com
2019-10-25 15:20:09 +08:00
parent 7011a4569d
commit 4a3a3a5091
11 changed files with 1812 additions and 6 deletions
+5 -6
View File
@@ -118,14 +118,13 @@ class Template extends Miniprogarampage
*/
public function sendTemplate()
{
$url = $this->sendUrl . '?access_token=' . $this->getAccessToken();
$url = $this->sendUrl . '?access_token=' . $this->config->getAccessToken();
$params = json_encode([
"touser" => $this->openId,
"touser" => $this->openId,
"template_id" => $this->templateId,
"page" => $this->page,
"form_id" => $this->formId,
"data" => $this->keywords,
"page" => $this->page,
"form_id" => $this->formId,
"data" => $this->keywords,
], JSON_UNESCAPED_UNICODE);
if (!empty($this->emphasis_keyword)) {
+31
View File
@@ -0,0 +1,31 @@
<?php
namespace wchat;
class Token extends Miniprogarampage
{
private $url = 'https://api.q.qq.com/cgi-bin/token';
/**
* @return mixed|null
*/
public function generateAccess_token()
{
$query = [
'grant_type' => 'client_credential',
'appid' => $this->config->getAppid(),
'secret' => $this->config->getAppsecret()
];
$param = $this->request->get($this->url, $query);
if (!$param->isResultsOK()) {
return null;
}
return $param->getData('access_token');
}
}
+9
View File
@@ -92,6 +92,15 @@ class Wx
return Notify::getInstance($this->config);
}
/**
* @return Token
*/
public function getToken()
{
return Token::getInstance($this->config);
}
/**
* @return WxClient
*/