- 优化cache和session服务

v6
Chaim 4 years ago
parent 6940c4af03
commit 012c709260

@ -1,5 +1,8 @@
## v6.0.94 / 2020-07-20
- 优化cache和session服务
## v6.0.93 / 2020-07-20
-修复请求门面的判断微信和微信小程序环境函数名错误问题
- 修复请求门面的判断微信和微信小程序环境函数名错误问题
## v6.0.92 / 2020-07-18
- 优化Api加密解密

@ -21,14 +21,12 @@ use DtApp\ThinkLibrary\cache\Mysql;
use DtApp\ThinkLibrary\exception\DtaException;
use DtApp\ThinkLibrary\service\QqWryService;
use DtApp\ThinkLibrary\service\SystemService;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
/**
* 定义当前版本
*/
const VERSION = '6.0.93';
const VERSION = '6.0.94';
if (!function_exists('get_ip_info')) {
/**
@ -92,10 +90,8 @@ if (!function_exists('dtacache')) {
* @param array $value
* @param int $expire
* @return bool|int|string
* @throws DataNotFoundException
* @throws DbException
* @throws DtaException
* @throws ModelNotFoundException
*/
function dtacache($name = '', $value = [], $expire = 6000)
{

@ -22,9 +22,7 @@ namespace DtApp\ThinkLibrary\service\wechat;
use DtApp\ThinkLibrary\exception\DtaException;
use DtApp\ThinkLibrary\Service;
use DtApp\ThinkLibrary\service\curl\HttpService;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
/**
* 微信小程序
@ -92,10 +90,8 @@ class MiniService extends Service
* https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/user-info/auth.getPaidUnionId.html
* @param string $openid
* @return bool|mixed|string
* @throws DataNotFoundException
* @throws DbException
* @throws DtaException
* @throws ModelNotFoundException
*/
public function getPaidUnionId(string $openid)
{
@ -112,10 +108,8 @@ class MiniService extends Service
* 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 createWxaQrCode(array $data = [])
{
@ -134,10 +128,8 @@ class MiniService extends Service
* 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 getWxaCode(array $data = [])
{
@ -156,10 +148,8 @@ class MiniService extends Service
* 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 getWxaCodeUnLimit(array $data = [])
{
@ -178,10 +168,8 @@ class MiniService extends Service
* https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/subscribe-message/subscribeMessage.addTemplate.html
* @param array $data
* @return bool|mixed|string
* @throws DataNotFoundException
* @throws DbException
* @throws DtaException
* @throws ModelNotFoundException
*/
public function addTemplate(array $data = [])
{
@ -199,10 +187,8 @@ class MiniService extends Service
* https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/subscribe-message/subscribeMessage.deleteTemplate.html
* @param string $priTmplId 要删除的模板id
* @return bool|mixed|string
* @throws DataNotFoundException
* @throws DbException
* @throws DtaException
* @throws ModelNotFoundException
*/
public function deleteTemplate(string $priTmplId)
{
@ -222,10 +208,8 @@ class MiniService extends Service
* 获取小程序账号的类目
* https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/subscribe-message/subscribeMessage.getCategory.html
* @return bool|mixed|string
* @throws DataNotFoundException
* @throws DbException
* @throws DtaException
* @throws ModelNotFoundException
*/
public function getCategory()
{
@ -242,10 +226,8 @@ class MiniService extends Service
* https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/subscribe-message/subscribeMessage.getPubTemplateKeyWordsById.html
* @param string $tid 模板标题 id
* @return bool|mixed|string
* @throws DataNotFoundException
* @throws DbException
* @throws DtaException
* @throws ModelNotFoundException
*/
public function getPubTemplateKeyWordsById(string $tid)
{
@ -266,10 +248,8 @@ class MiniService extends Service
* https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/subscribe-message/subscribeMessage.getPubTemplateTitleList.html
* @param array $data
* @return bool|mixed|string
* @throws DataNotFoundException
* @throws DbException
* @throws DtaException
* @throws ModelNotFoundException
*/
public function getPubTemplateTitleList(array $data = [])
{
@ -286,10 +266,8 @@ class MiniService extends Service
* 获取当前帐号下的个人模板列表
* https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/subscribe-message/subscribeMessage.getTemplateList.html
* @return bool|mixed|string
* @throws DataNotFoundException
* @throws DbException
* @throws DtaException
* @throws ModelNotFoundException
*/
public function getTemplateList()
{
@ -306,10 +284,8 @@ class MiniService extends Service
* https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/subscribe-message/subscribeMessage.send.html
* @param array $data
* @return bool|mixed|string
* @throws DataNotFoundException
* @throws DbException
* @throws DtaException
* @throws ModelNotFoundException
*/
public function subscribeMessageSend(array $data = [])
{
@ -401,10 +377,8 @@ class MiniService extends Service
* 获取小程序全局唯一后台接口调用凭据access_token
* https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/access-token/auth.getAccessToken.html
* @return bool|mixed|string
* @throws DataNotFoundException
* @throws DbException
* @throws DtaException
* @throws ModelNotFoundException
*/
public function accessToken()
{
@ -415,10 +389,8 @@ class MiniService extends Service
/**
* 获取access_token信息
* @return array|bool|mixed|string|string[]
* @throws DataNotFoundException
* @throws DbException
* @throws DtaException
* @throws ModelNotFoundException
*/
private function getAccessToken()
{

@ -26,9 +26,7 @@ use DtApp\ThinkLibrary\facade\Urls;
use DtApp\ThinkLibrary\facade\Xmls;
use DtApp\ThinkLibrary\Service;
use DtApp\ThinkLibrary\service\curl\HttpService;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
/**
* 公众号
@ -301,10 +299,8 @@ class WebAppService extends Service
/**
* 分享
* @return array
* @throws DataNotFoundException
* @throws DbException
* @throws DtaException
* @throws ModelNotFoundException
*/
public function share()
{
@ -368,10 +364,8 @@ class WebAppService extends Service
* 生成二维码
* @param array $data
* @return array|bool|mixed|string
* @throws DataNotFoundException
* @throws DbException
* @throws DtaException
* @throws ModelNotFoundException
*/
public function qrCode(array $data)
{
@ -388,10 +382,8 @@ class WebAppService extends Service
* 发送模板消息
* @param array $data
* @return array|bool|mixed|string
* @throws DataNotFoundException
* @throws DbException
* @throws DtaException
* @throws ModelNotFoundException
*/
public function messageTemplateSend(array $data = [])
{
@ -410,10 +402,8 @@ class WebAppService extends Service
* @param string $access_token
* @param array $data
* @return bool|mixed|string
* @throws DataNotFoundException
* @throws DbException
* @throws DtaException
* @throws ModelNotFoundException
*/
public function setIndustry(string $access_token, array $data = [])
{
@ -430,10 +420,8 @@ class WebAppService extends Service
* 将一条长链接转成短链接
* @param string $long_url
* @return bool
* @throws DataNotFoundException
* @throws DbException
* @throws DtaException
* @throws ModelNotFoundException
*/
public function shortUrl(string $long_url)
{
@ -454,10 +442,8 @@ class WebAppService extends Service
* https://developers.weixin.qq.com/doc/offiaccount/WiFi_via_WeChat/WiFi_mini_programs.html
* @param array $data
* @return array|bool|mixed|string
* @throws DataNotFoundException
* @throws DbException
* @throws DtaException
* @throws ModelNotFoundException
*/
public function fiNihPageSet(array $data = [])
{
@ -475,10 +461,8 @@ class WebAppService extends Service
* 自定义菜单 获取自定义菜单配置
* https://developers.weixin.qq.com/doc/offiaccount/Custom_Menus/Getting_Custom_Menu_Configurations.html
* @return array|bool|mixed|string
* @throws DataNotFoundException
* @throws DbException
* @throws DtaException
* @throws ModelNotFoundException
*/
public function menuGet()
{
@ -495,10 +479,8 @@ class WebAppService extends Service
* https://developers.weixin.qq.com/doc/offiaccount/Custom_Menus/Personalized_menu_interface.html
* @param array $data
* @return array|bool|mixed|string
* @throws DataNotFoundException
* @throws DbException
* @throws DtaException
* @throws ModelNotFoundException
*/
public function menuAddConditional(array $data = [])
{
@ -517,10 +499,8 @@ class WebAppService extends Service
* https://developers.weixin.qq.com/doc/offiaccount/Custom_Menus/Personalized_menu_interface.html
* @param array $data
* @return array|bool|mixed|string
* @throws DataNotFoundException
* @throws DbException
* @throws DtaException
* @throws ModelNotFoundException
*/
public function menuDelConditional(array $data = [])
{
@ -539,10 +519,8 @@ class WebAppService extends Service
* https://developers.weixin.qq.com/doc/offiaccount/Custom_Menus/Personalized_menu_interface.html
* @param array $data
* @return array|bool|mixed|string
* @throws DataNotFoundException
* @throws DbException
* @throws DtaException
* @throws ModelNotFoundException
*/
public function menuTryMatch(array $data = [])
{
@ -560,10 +538,8 @@ class WebAppService extends Service
* 自定义菜单 删除接口
* https://developers.weixin.qq.com/doc/offiaccount/Custom_Menus/Deleting_Custom-Defined_Menu.html
* @return array|bool|mixed|string
* @throws DataNotFoundException
* @throws DbException
* @throws DtaException
* @throws ModelNotFoundException
*/
public function menuDelete()
{
@ -579,10 +555,8 @@ class WebAppService extends Service
* 自定义菜单 查询接口
* https://developers.weixin.qq.com/doc/offiaccount/Custom_Menus/Querying_Custom_Menus.html
* @return array|bool|mixed|string
* @throws DataNotFoundException
* @throws DbException
* @throws DtaException
* @throws ModelNotFoundException
*/
public function getCurrentSelfmenuInfo()
{
@ -599,10 +573,8 @@ class WebAppService extends Service
* https://developers.weixin.qq.com/doc/offiaccount/Custom_Menus/Creating_Custom-Defined_Menu.html
* @param array $data
* @return array|bool|mixed|string
* @throws DataNotFoundException
* @throws DbException
* @throws DtaException
* @throws ModelNotFoundException
*/
public function menuCreate(array $data = [])
{
@ -619,10 +591,8 @@ class WebAppService extends Service
/**
* 获取access_token信息
* @return array|bool|mixed|string|string[]
* @throws DataNotFoundException
* @throws DbException
* @throws DtaException
* @throws ModelNotFoundException
*/
private function getAccessToken()
{

@ -59,6 +59,7 @@ class Mysql implements SessionHandlerInterface
return (string)Db::table($this->table_name)
->where('session_id', $this->config['session_prefix'] . $sessionId)
->whereTime('session_expire', '>=', time())
->order('session_expire desc')
->value('session_data', '');
}

Loading…
Cancel
Save