2019-11-11 18:14:47 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
2020-03-05 12:41:49 +08:00
|
|
|
namespace wchat\officialaccount;
|
2019-11-11 18:14:47 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class Tag extends AfficialAccount
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
private $generate_url = 'https://api.weixin.qq.com/cgi-bin/tags/create?access_token=';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param $tagName
|
|
|
|
|
* @return mixed
|
|
|
|
|
* @throws \Exception
|
|
|
|
|
*/
|
|
|
|
|
public function generate($tagName)
|
|
|
|
|
{
|
|
|
|
|
$url['tag[name]'] = $tagName;
|
|
|
|
|
|
|
|
|
|
$config = $this->config->getAccessToken();
|
|
|
|
|
|
|
|
|
|
$result = $this->request->post($this->generate_url . $config, $url);
|
|
|
|
|
if (!$result->isResultsOK()) {
|
|
|
|
|
throw new \Exception($result->getMessage());
|
|
|
|
|
}
|
|
|
|
|
return $result->getData();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|