|
|
|
@ -388,6 +388,72 @@ class MiniService extends Service
|
|
|
|
|
return $this->getAccessToken();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取小程序二维码,适用于需要的码数量较少的业务场景。通过该接口生成的小程序码,永久有效,有数量限制
|
|
|
|
|
* https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/qr-code/wxacode.createQRCode.html
|
|
|
|
|
* @param array $data
|
|
|
|
|
* @return array|bool|mixed|string
|
|
|
|
|
* @throws DataNotFoundException
|
|
|
|
|
* @throws DbException
|
|
|
|
|
* @throws DtaException
|
|
|
|
|
* @throws ModelNotFoundException
|
|
|
|
|
*/
|
|
|
|
|
public function wxaCodeCreateQRCode(array $data = [])
|
|
|
|
|
{
|
|
|
|
|
// 获取数据
|
|
|
|
|
$accessToken = $this->getAccessToken();
|
|
|
|
|
$url = "{$this->api_url}cgi-bin/wxaapp/createwxaqrcode?access_token={$accessToken['access_token']}";
|
|
|
|
|
return HttpService::instance()
|
|
|
|
|
->url($url)
|
|
|
|
|
->data($data)
|
|
|
|
|
->post()
|
|
|
|
|
->toArray();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取小程序码,适用于需要的码数量较少的业务场景。通过该接口生成的小程序码,永久有效,有数量限制
|
|
|
|
|
* https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/qr-code/wxacode.get.html
|
|
|
|
|
* @param array $data
|
|
|
|
|
* @return array|bool|mixed|string
|
|
|
|
|
* @throws DataNotFoundException
|
|
|
|
|
* @throws DbException
|
|
|
|
|
* @throws DtaException
|
|
|
|
|
* @throws ModelNotFoundException
|
|
|
|
|
*/
|
|
|
|
|
public function wxaCodeGet(array $data = [])
|
|
|
|
|
{
|
|
|
|
|
// 获取数据
|
|
|
|
|
$accessToken = $this->getAccessToken();
|
|
|
|
|
$url = "{$this->api_url}wxa/getwxacode?access_token={$accessToken['access_token']}";
|
|
|
|
|
return HttpService::instance()
|
|
|
|
|
->url($url)
|
|
|
|
|
->data($data)
|
|
|
|
|
->post()
|
|
|
|
|
->toArray();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取小程序码,适用于需要的码数量极多的业务场景。通过该接口生成的小程序码,永久有效,数量暂无限制
|
|
|
|
|
* https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/qr-code/wxacode.getUnlimited.html
|
|
|
|
|
* @param array $data
|
|
|
|
|
* @return array|bool|mixed|string
|
|
|
|
|
* @throws DataNotFoundException
|
|
|
|
|
* @throws DbException
|
|
|
|
|
* @throws DtaException
|
|
|
|
|
* @throws ModelNotFoundException
|
|
|
|
|
*/
|
|
|
|
|
public function wxaCodeGetUnlimited(array $data = [])
|
|
|
|
|
{
|
|
|
|
|
// 获取数据
|
|
|
|
|
$accessToken = $this->getAccessToken();
|
|
|
|
|
$url = "{$this->api_url}wxa/getwxacodeunlimit?access_token={$accessToken['access_token']}";
|
|
|
|
|
return HttpService::instance()
|
|
|
|
|
->url($url)
|
|
|
|
|
->data($data)
|
|
|
|
|
->post()
|
|
|
|
|
->toArray();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取access_token信息
|
|
|
|
|
* @return array|bool|mixed|string|string[]
|
|
|
|
|