|
|
@ -22,9 +22,6 @@ use DtApp\ThinkLibrary\exception\CurlException;
|
|
|
|
use DtApp\ThinkLibrary\exception\WeChatException;
|
|
|
|
use DtApp\ThinkLibrary\exception\WeChatException;
|
|
|
|
use DtApp\ThinkLibrary\Service;
|
|
|
|
use DtApp\ThinkLibrary\Service;
|
|
|
|
use DtApp\ThinkLibrary\service\curl\HttpService;
|
|
|
|
use DtApp\ThinkLibrary\service\curl\HttpService;
|
|
|
|
use think\db\exception\DataNotFoundException;
|
|
|
|
|
|
|
|
use think\db\exception\DbException;
|
|
|
|
|
|
|
|
use think\db\exception\ModelNotFoundException;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 微信小程序
|
|
|
|
* 微信小程序
|
|
|
@ -83,9 +80,6 @@ class MiniService extends Service
|
|
|
|
* @return bool|mixed|string
|
|
|
|
* @return bool|mixed|string
|
|
|
|
* @throws CacheException
|
|
|
|
* @throws CacheException
|
|
|
|
* @throws CurlException
|
|
|
|
* @throws CurlException
|
|
|
|
* @throws DataNotFoundException
|
|
|
|
|
|
|
|
* @throws DbException
|
|
|
|
|
|
|
|
* @throws ModelNotFoundException
|
|
|
|
|
|
|
|
* @throws WeChatException
|
|
|
|
* @throws WeChatException
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function getPaidUnionId(string $openid)
|
|
|
|
public function getPaidUnionId(string $openid)
|
|
|
@ -105,9 +99,6 @@ class MiniService extends Service
|
|
|
|
* @return array|bool|mixed|string
|
|
|
|
* @return array|bool|mixed|string
|
|
|
|
* @throws CacheException
|
|
|
|
* @throws CacheException
|
|
|
|
* @throws CurlException
|
|
|
|
* @throws CurlException
|
|
|
|
* @throws DataNotFoundException
|
|
|
|
|
|
|
|
* @throws DbException
|
|
|
|
|
|
|
|
* @throws ModelNotFoundException
|
|
|
|
|
|
|
|
* @throws WeChatException
|
|
|
|
* @throws WeChatException
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function createWxaQrCode(array $data = [])
|
|
|
|
public function createWxaQrCode(array $data = [])
|
|
|
@ -129,9 +120,6 @@ class MiniService extends Service
|
|
|
|
* @return array|bool|mixed|string
|
|
|
|
* @return array|bool|mixed|string
|
|
|
|
* @throws CacheException
|
|
|
|
* @throws CacheException
|
|
|
|
* @throws CurlException
|
|
|
|
* @throws CurlException
|
|
|
|
* @throws DataNotFoundException
|
|
|
|
|
|
|
|
* @throws DbException
|
|
|
|
|
|
|
|
* @throws ModelNotFoundException
|
|
|
|
|
|
|
|
* @throws WeChatException
|
|
|
|
* @throws WeChatException
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function getWxaCode(array $data = [])
|
|
|
|
public function getWxaCode(array $data = [])
|
|
|
@ -153,9 +141,6 @@ class MiniService extends Service
|
|
|
|
* @return array|bool|mixed|string
|
|
|
|
* @return array|bool|mixed|string
|
|
|
|
* @throws CacheException
|
|
|
|
* @throws CacheException
|
|
|
|
* @throws CurlException
|
|
|
|
* @throws CurlException
|
|
|
|
* @throws DataNotFoundException
|
|
|
|
|
|
|
|
* @throws DbException
|
|
|
|
|
|
|
|
* @throws ModelNotFoundException
|
|
|
|
|
|
|
|
* @throws WeChatException
|
|
|
|
* @throws WeChatException
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function getWxaCodeUnLimit(array $data = [])
|
|
|
|
public function getWxaCodeUnLimit(array $data = [])
|
|
|
@ -177,9 +162,6 @@ class MiniService extends Service
|
|
|
|
* @return bool|mixed|string
|
|
|
|
* @return bool|mixed|string
|
|
|
|
* @throws CacheException
|
|
|
|
* @throws CacheException
|
|
|
|
* @throws CurlException
|
|
|
|
* @throws CurlException
|
|
|
|
* @throws DataNotFoundException
|
|
|
|
|
|
|
|
* @throws DbException
|
|
|
|
|
|
|
|
* @throws ModelNotFoundException
|
|
|
|
|
|
|
|
* @throws WeChatException
|
|
|
|
* @throws WeChatException
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function addTemplate(array $data = [])
|
|
|
|
public function addTemplate(array $data = [])
|
|
|
@ -200,9 +182,6 @@ class MiniService extends Service
|
|
|
|
* @return bool|mixed|string
|
|
|
|
* @return bool|mixed|string
|
|
|
|
* @throws CacheException
|
|
|
|
* @throws CacheException
|
|
|
|
* @throws CurlException
|
|
|
|
* @throws CurlException
|
|
|
|
* @throws DataNotFoundException
|
|
|
|
|
|
|
|
* @throws DbException
|
|
|
|
|
|
|
|
* @throws ModelNotFoundException
|
|
|
|
|
|
|
|
* @throws WeChatException
|
|
|
|
* @throws WeChatException
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function deleteTemplate(string $priTmplId)
|
|
|
|
public function deleteTemplate(string $priTmplId)
|
|
|
@ -225,9 +204,6 @@ class MiniService extends Service
|
|
|
|
* @return bool|mixed|string
|
|
|
|
* @return bool|mixed|string
|
|
|
|
* @throws CacheException
|
|
|
|
* @throws CacheException
|
|
|
|
* @throws CurlException
|
|
|
|
* @throws CurlException
|
|
|
|
* @throws DataNotFoundException
|
|
|
|
|
|
|
|
* @throws DbException
|
|
|
|
|
|
|
|
* @throws ModelNotFoundException
|
|
|
|
|
|
|
|
* @throws WeChatException
|
|
|
|
* @throws WeChatException
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function getCategory()
|
|
|
|
public function getCategory()
|
|
|
@ -247,9 +223,6 @@ class MiniService extends Service
|
|
|
|
* @return bool|mixed|string
|
|
|
|
* @return bool|mixed|string
|
|
|
|
* @throws CacheException
|
|
|
|
* @throws CacheException
|
|
|
|
* @throws CurlException
|
|
|
|
* @throws CurlException
|
|
|
|
* @throws DataNotFoundException
|
|
|
|
|
|
|
|
* @throws DbException
|
|
|
|
|
|
|
|
* @throws ModelNotFoundException
|
|
|
|
|
|
|
|
* @throws WeChatException
|
|
|
|
* @throws WeChatException
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function getPubTemplateKeyWordsById(string $tid)
|
|
|
|
public function getPubTemplateKeyWordsById(string $tid)
|
|
|
@ -273,9 +246,6 @@ class MiniService extends Service
|
|
|
|
* @return bool|mixed|string
|
|
|
|
* @return bool|mixed|string
|
|
|
|
* @throws CacheException
|
|
|
|
* @throws CacheException
|
|
|
|
* @throws CurlException
|
|
|
|
* @throws CurlException
|
|
|
|
* @throws DataNotFoundException
|
|
|
|
|
|
|
|
* @throws DbException
|
|
|
|
|
|
|
|
* @throws ModelNotFoundException
|
|
|
|
|
|
|
|
* @throws WeChatException
|
|
|
|
* @throws WeChatException
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function getPubTemplateTitleList(array $data = [])
|
|
|
|
public function getPubTemplateTitleList(array $data = [])
|
|
|
@ -295,9 +265,6 @@ class MiniService extends Service
|
|
|
|
* @return bool|mixed|string
|
|
|
|
* @return bool|mixed|string
|
|
|
|
* @throws CacheException
|
|
|
|
* @throws CacheException
|
|
|
|
* @throws CurlException
|
|
|
|
* @throws CurlException
|
|
|
|
* @throws DataNotFoundException
|
|
|
|
|
|
|
|
* @throws DbException
|
|
|
|
|
|
|
|
* @throws ModelNotFoundException
|
|
|
|
|
|
|
|
* @throws WeChatException
|
|
|
|
* @throws WeChatException
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function getTemplateList()
|
|
|
|
public function getTemplateList()
|
|
|
@ -317,9 +284,6 @@ class MiniService extends Service
|
|
|
|
* @return bool|mixed|string
|
|
|
|
* @return bool|mixed|string
|
|
|
|
* @throws CacheException
|
|
|
|
* @throws CacheException
|
|
|
|
* @throws CurlException
|
|
|
|
* @throws CurlException
|
|
|
|
* @throws DataNotFoundException
|
|
|
|
|
|
|
|
* @throws DbException
|
|
|
|
|
|
|
|
* @throws ModelNotFoundException
|
|
|
|
|
|
|
|
* @throws WeChatException
|
|
|
|
* @throws WeChatException
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function subscribeMessageSend(array $data = [])
|
|
|
|
public function subscribeMessageSend(array $data = [])
|
|
|
@ -372,9 +336,6 @@ class MiniService extends Service
|
|
|
|
* @return bool|mixed|string
|
|
|
|
* @return bool|mixed|string
|
|
|
|
* @throws CacheException
|
|
|
|
* @throws CacheException
|
|
|
|
* @throws CurlException
|
|
|
|
* @throws CurlException
|
|
|
|
* @throws DataNotFoundException
|
|
|
|
|
|
|
|
* @throws DbException
|
|
|
|
|
|
|
|
* @throws ModelNotFoundException
|
|
|
|
|
|
|
|
* @throws WeChatException
|
|
|
|
* @throws WeChatException
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function accessToken()
|
|
|
|
public function accessToken()
|
|
|
@ -383,15 +344,25 @@ class MiniService extends Service
|
|
|
|
return $this->getAccessToken();
|
|
|
|
return $this->getAccessToken();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 数据签名校验
|
|
|
|
|
|
|
|
* @param string $encrypted_data
|
|
|
|
|
|
|
|
* @param string $session_key
|
|
|
|
|
|
|
|
* @param string $iv
|
|
|
|
|
|
|
|
* @return mixed
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public function decode(string $encrypted_data, string $session_key, string $iv)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
$result = openssl_decrypt(base64_decode($encrypted_data), "AES-128-CBC", base64_decode($session_key), 1, base64_decode($iv));
|
|
|
|
|
|
|
|
return json_decode($result, true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 获取access_token信息
|
|
|
|
* 获取access_token信息
|
|
|
|
* @return array|bool|mixed|string|string[]
|
|
|
|
* @return array|bool|mixed|string|string[]
|
|
|
|
* @throws CacheException
|
|
|
|
* @throws CacheException
|
|
|
|
* @throws CurlException
|
|
|
|
* @throws CurlException
|
|
|
|
* @throws WeChatException
|
|
|
|
* @throws WeChatException
|
|
|
|
* @throws DataNotFoundException
|
|
|
|
|
|
|
|
* @throws DbException
|
|
|
|
|
|
|
|
* @throws ModelNotFoundException
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private function getAccessToken()
|
|
|
|
private function getAccessToken()
|
|
|
|
{
|
|
|
|
{
|
|
|
|