diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d14993..95e38d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## v6.0.90 / 2020-07-18 +- 优化代码 + ## v6.0.89 / 2020-07-18 - 修复获取配置问题 diff --git a/src/ApiController.php b/src/ApiController.php index 44910e9..6c19886 100644 --- a/src/ApiController.php +++ b/src/ApiController.php @@ -197,27 +197,23 @@ class ApiController extends stdClass */ public function _judgeSign($name = 'sniff_h5') { - if (empty($this->request->header('sign', ''))) { + // 加密的数据参数 + $aes = $this->request->post('aes', ''); + if (empty($aes)) { $this->error('数据未签名!', 104); } - - // 加密的数据参数 - $aes = $this->request->post('aes'); // 获取时间数据 $timestamp = $this->request->get('timestamp', 0); - // 判断是否有时间 if (empty($timestamp)) { $this->error('数据异常!', 105); } - // 解密 $aes_decode = $this->decrypt($aes, $name, $timestamp); if (empty($aes_decode)) { $this->error('解密失败', 106); } $data = json_decode($aes_decode, true); - // 判断是不是小于服务器时间 $before = strtotime('-2minute'); $rear = strtotime('+2minute'); diff --git a/src/common.php b/src/common.php index 22f09b3..c00f5ae 100644 --- a/src/common.php +++ b/src/common.php @@ -28,7 +28,7 @@ use think\db\exception\ModelNotFoundException; /** * 定义当前版本 */ -const VERSION = '6.0.89'; +const VERSION = '6.0.90'; if (!function_exists('get_ip_info')) { /** diff --git a/src/service/StorageService.php b/src/service/StorageService.php index abd76db..8c8b623 100644 --- a/src/service/StorageService.php +++ b/src/service/StorageService.php @@ -58,7 +58,7 @@ class StorageService extends Service */ private function getConfig() { - $this->path = $this->app->config->get('dtapp.storage.path'); + $this->path = config('dtapp.storage.path'); return $this; } diff --git a/src/service/SystemService.php b/src/service/SystemService.php index e531ec4..b80a4a7 100644 --- a/src/service/SystemService.php +++ b/src/service/SystemService.php @@ -40,12 +40,12 @@ class SystemService extends Service */ public function uri($url = '', array $vars = [], $suffix = true, $domain = false, $fillSuffix = false) { - $default_app = $this->app->config->get('app.default_app', 'index'); - $default_action = $this->app->config->get('route.default_action', 'index'); - $default_controller = $this->app->config->get('route.default_controller', 'Index'); - $url_html_suffix = $this->app->config->get('route.url_html_suffix', 'html'); - $pathinfo_depr = $this->app->config->get('route.pathinfo_depr', '/'); - $url_common_param = $this->app->config->get('route.url_common_param', true); + $default_app = config('app.default_app', 'index'); + $default_action = config('route.default_action', 'index'); + $default_controller = config('route.default_controller', 'Index'); + $url_html_suffix = config('route.url_html_suffix', 'html'); + $pathinfo_depr = config('route.pathinfo_depr', '/'); + $url_common_param = config('route.url_common_param', true); if (empty($url)) { $url = "{$default_app}/{$default_action}/{$default_controller}"; } diff --git a/src/service/aliyun/OssService.php b/src/service/aliyun/OssService.php index a093808..ea8f796 100644 --- a/src/service/aliyun/OssService.php +++ b/src/service/aliyun/OssService.php @@ -63,10 +63,10 @@ class OssService extends Service */ private function getConfig() { - $this->accessKeyId = $this->app->config->get('dtapp.aliyun.oss.access_key_id'); - $this->accessKeySecret = $this->app->config->get('dtapp.aliyun.oss.access_key_secret'); - $this->endpoint = $this->app->config->get('dtapp.aliyun.oss.endpoint'); - $this->bucket = $this->app->config->get('dtapp.aliyun.oss.bucket'); + $this->accessKeyId = config('dtapp.aliyun.oss.access_key_id'); + $this->accessKeySecret = config('dtapp.aliyun.oss.access_key_secret'); + $this->endpoint = config('dtapp.aliyun.oss.endpoint'); + $this->bucket = config('dtapp.aliyun.oss.bucket'); return $this; } @@ -84,7 +84,7 @@ class OssService extends Service try { $ossClient = new OssClient($this->accessKeyId, $this->accessKeySecret, $this->endpoint); $ossClient->uploadFile($this->bucket, $object, $filePath); - return $this->app->config->get('dtapp.aliyun.oss.url', '') . $object; + return config('dtapp.aliyun.oss.url', '') . $object; } catch (OssException $e) { return $e->getMessage(); } diff --git a/src/service/baidu/BosService.php b/src/service/baidu/BosService.php index 886ffab..8262c57 100644 --- a/src/service/baidu/BosService.php +++ b/src/service/baidu/BosService.php @@ -63,10 +63,10 @@ class BosService extends Service */ private function getConfig() { - $this->accessKeyId = $this->app->config->get('dtapp.baidu.bos.access_key_id'); - $this->secretAccessKey = $this->app->config->get('dtapp.baidu.bos.secret_access_key'); - $this->endpoint = $this->app->config->get('dtapp.baidu.bos.endpoint'); - $this->bucket = $this->app->config->get('dtapp.baidu.bos.bucket'); + $this->accessKeyId = config('dtapp.baidu.bos.access_key_id'); + $this->secretAccessKey = config('dtapp.baidu.bos.secret_access_key'); + $this->endpoint = config('dtapp.baidu.bos.endpoint'); + $this->bucket = config('dtapp.baidu.bos.bucket'); return $this; } @@ -96,6 +96,6 @@ class BosService extends Service $this->getConfig(); } $client->putObjectFromFile($this->bucket, $object, $filePath); - return $this->app->config->get('dtapp.baidu.bos.url', '') . $object; + return config('dtapp.baidu.bos.url', '') . $object; } } diff --git a/src/service/bt/ApiService.php b/src/service/bt/ApiService.php index cb05bc1..253cc82 100644 --- a/src/service/bt/ApiService.php +++ b/src/service/bt/ApiService.php @@ -57,8 +57,8 @@ class ApiService extends Service */ private function getConfig() { - $this->key = $this->app->config->get('dtapp.bt.key'); - $this->panel = $this->app->config->get('dtapp.bt.panel'); + $this->key = config('dtapp.bt.key'); + $this->panel = config('dtapp.bt.panel'); return $this; } diff --git a/src/service/douyin/WatermarkService.php b/src/service/douyin/WatermarkService.php index e6b9ea4..69a3f2d 100644 --- a/src/service/douyin/WatermarkService.php +++ b/src/service/douyin/WatermarkService.php @@ -526,8 +526,8 @@ class WatermarkService extends Service ->upload($yun_path . $backtrack['video_info']['vid'] . "_playwm" . ".mp4", $system_path . $backtrack['video_info']['vid'] . "_playwm" . ".mp4"); break; case "storage": - $domain_name = $this->app->config->get('dtapp.storage.domain_name'); - $new_yun_path = $this->app->config->get("dtapp.storage.domain_list.{$domain_name}") . "upload/watermark/{$yun_path}"; + $domain_name = config('dtapp.storage.domain_name'); + $new_yun_path = config("dtapp.storage.domain_list.{$domain_name}") . "upload/watermark/{$yun_path}"; // 本地存储 // 作者头像 $backtrack['yun']['author_info']['avatar'] = "{$new_yun_path}" . $backtrack['author_info']['uid'] . ".jpeg"; diff --git a/src/service/huaweicloud/ObsService.php b/src/service/huaweicloud/ObsService.php index ff49495..c007ec6 100644 --- a/src/service/huaweicloud/ObsService.php +++ b/src/service/huaweicloud/ObsService.php @@ -62,10 +62,10 @@ class ObsService extends Service */ private function getConfig() { - $this->key = $this->app->config->get('dtapp.huaweicloud.obs.key'); - $this->secret = $this->app->config->get('dtapp.huaweicloud.obs.secret'); - $this->endpoint = $this->app->config->get('dtapp.huaweicloud.obs.endpoint'); - $this->bucket = $this->app->config->get('dtapp.huaweicloud.obs.bucket'); + $this->key = config('dtapp.huaweicloud.obs.key'); + $this->secret = config('dtapp.huaweicloud.obs.secret'); + $this->endpoint = config('dtapp.huaweicloud.obs.endpoint'); + $this->bucket = config('dtapp.huaweicloud.obs.bucket'); return $this; } @@ -95,7 +95,7 @@ class ObsService extends Service 'SourceFile' => $filePath // localfile为待上传的本地文件路径,需要指定到具体的文件名 ]); if (isset($resp['RequestId'])) { - return $this->app->config->get('dtapp.huaweicloud.obs.url', '') . $object; + return config('dtapp.huaweicloud.obs.url', '') . $object; } else { return false; } diff --git a/src/service/jd/UnionService.php b/src/service/jd/UnionService.php index 4e64188..dbe031a 100644 --- a/src/service/jd/UnionService.php +++ b/src/service/jd/UnionService.php @@ -158,8 +158,8 @@ class UnionService extends Service */ private function getConfig() { - $this->app_key = $this->app->config->get('dtapp.jd.union.app_key'); - $this->secret_key = $this->app->config->get('dtapp.jd.union.secret_key'); + $this->app_key = config('dtapp.jd.union.app_key'); + $this->secret_key = config('dtapp.jd.union.secret_key'); return $this; } diff --git a/src/service/ksyun/Ks3Service.php b/src/service/ksyun/Ks3Service.php index 2cc87aa..6bfd340 100644 --- a/src/service/ksyun/Ks3Service.php +++ b/src/service/ksyun/Ks3Service.php @@ -63,10 +63,10 @@ class Ks3Service extends Service */ private function getConfig() { - $this->accessKeyID = $this->app->config->get('dtapp.ksyun.ks3.access_key_iD'); - $this->accessKeySecret = $this->app->config->get('dtapp.ksyun.ks3.access_key_secret'); - $this->endpoint = $this->app->config->get('dtapp.ksyun.ks3.endpoint'); - $this->bucket = $this->app->config->get('dtapp.ksyun.ks3.bucket'); + $this->accessKeyID = config('dtapp.ksyun.ks3.access_key_iD'); + $this->accessKeySecret = config('dtapp.ksyun.ks3.access_key_secret'); + $this->endpoint = config('dtapp.ksyun.ks3.endpoint'); + $this->bucket = config('dtapp.ksyun.ks3.bucket'); return $this; } @@ -108,7 +108,7 @@ class Ks3Service extends Service ]; try { $client->putObjectByFile($args); - return $this->app->config->get('dtapp.ksyun.ks3.url', '') . $object; + return config('dtapp.ksyun.ks3.url', '') . $object; } catch (Ks3ServiceException $e) { return false; } diff --git a/src/service/pinduoduo/JinBaoService.php b/src/service/pinduoduo/JinBaoService.php index 0757fda..8c68a41 100644 --- a/src/service/pinduoduo/JinBaoService.php +++ b/src/service/pinduoduo/JinBaoService.php @@ -152,8 +152,8 @@ class JinBaoService extends Service */ private function getConfig() { - $this->client_id = $this->app->config->get('dtapp.pinduoduo.jinbao.client_id'); - $this->client_secret = $this->app->config->get('dtapp.pinduoduo.jinbao.client_secret'); + $this->client_id = config('dtapp.pinduoduo.jinbao.client_id'); + $this->client_secret = config('dtapp.pinduoduo.jinbao.client_secret'); return $this; } diff --git a/src/service/qiniu/KodoService.php b/src/service/qiniu/KodoService.php index c26e7fd..0035231 100644 --- a/src/service/qiniu/KodoService.php +++ b/src/service/qiniu/KodoService.php @@ -58,9 +58,9 @@ class KodoService extends Service */ private function getConfig() { - $this->accessKey = $this->app->config->get('dtapp.qiniu.kodo.access_key'); - $this->secretKey = $this->app->config->get('dtapp.qiniu.kodo.secret_key'); - $this->bucket = $this->app->config->get('dtapp.qiniu.kodo.bucket'); + $this->accessKey = config('dtapp.qiniu.kodo.access_key'); + $this->secretKey = config('dtapp.qiniu.kodo.secret_key'); + $this->bucket = config('dtapp.qiniu.kodo.bucket'); return $this; } @@ -87,7 +87,7 @@ class KodoService extends Service if ($err !== null) { return false; } else { - return $this->app->config->get('dtapp.qiniu.kodo.url', '') . $object; + return config('dtapp.qiniu.kodo.url', '') . $object; } } } diff --git a/src/service/taobao/TbkService.php b/src/service/taobao/TbkService.php index 9f7f160..f8b2060 100644 --- a/src/service/taobao/TbkService.php +++ b/src/service/taobao/TbkService.php @@ -146,8 +146,8 @@ class TbkService extends Service */ private function getConfig() { - $this->app_key = $this->app->config->get('dtapp.taobao.tbk.app_key'); - $this->app_secret = $this->app->config->get('dtapp.taobao.tbk.app_secret'); + $this->app_key = config('dtapp.taobao.tbk.app_key'); + $this->app_secret = config('dtapp.taobao.tbk.app_secret'); return $this; } diff --git a/src/service/tencent/CosService.php b/src/service/tencent/CosService.php index c255e05..9460c58 100644 --- a/src/service/tencent/CosService.php +++ b/src/service/tencent/CosService.php @@ -63,10 +63,10 @@ class CosService extends Service */ private function getConfig() { - $this->secretId = $this->app->config->get('dtapp.tencent.cos.secret_id'); - $this->secretKey = $this->app->config->get('dtapp.tencent.cos.secret_key'); - $this->region = $this->app->config->get('dtapp.tencent.cos.region'); - $this->bucket = $this->app->config->get('dtapp.tencent.cos.bucket'); + $this->secretId = config('dtapp.tencent.cos.secret_id'); + $this->secretKey = config('dtapp.tencent.cos.secret_key'); + $this->region = config('dtapp.tencent.cos.region'); + $this->bucket = config('dtapp.tencent.cos.bucket'); return $this; } @@ -105,6 +105,6 @@ class CosService extends Service ); } } - return $this->app->config->get('dtapp.tencent.cos.url', '') . $object; + return config('dtapp.tencent.cos.url', '') . $object; } } diff --git a/src/service/upyun/UssService.php b/src/service/upyun/UssService.php index 2fa1e25..80c01f6 100644 --- a/src/service/upyun/UssService.php +++ b/src/service/upyun/UssService.php @@ -58,9 +58,9 @@ class UssService extends Service */ private function getConfig() { - $this->serviceName = $this->app->config->get('dtapp.upyun.uss.service_name'); - $this->operatorName = $this->app->config->get('dtapp.upyun.uss.operator_name'); - $this->operatorPassword = $this->app->config->get('dtapp.upyun.uss.operator_password'); + $this->serviceName = config('dtapp.upyun.uss.service_name'); + $this->operatorName = config('dtapp.upyun.uss.operator_name'); + $this->operatorPassword = config('dtapp.upyun.uss.operator_password'); return $this; } @@ -80,6 +80,6 @@ class UssService extends Service $client = new Upyun($serviceConfig); $file = fopen($filePath, 'r'); $client->write($object, $file); - return $this->app->config->get('dtapp.upyun.uss.url', '') . $object; + return config('dtapp.upyun.uss.url', '') . $object; } } diff --git a/src/service/wechat/MiniService.php b/src/service/wechat/MiniService.php index 74e546d..9544f8a 100644 --- a/src/service/wechat/MiniService.php +++ b/src/service/wechat/MiniService.php @@ -81,9 +81,9 @@ class MiniService extends Service */ private function getConfig() { - $this->cache = $this->app->config->get('dtapp.wechat.mini.cache'); - $this->app_id = $this->app->config->get('dtapp.wechat.mini.app_id'); - $this->app_secret = $this->app->config->get('dtapp.wechat.mini.app_secret'); + $this->cache = config('dtapp.wechat.mini.cache'); + $this->app_id = config('dtapp.wechat.mini.app_id'); + $this->app_secret = config('dtapp.wechat.mini.app_secret'); return $this; } diff --git a/src/service/wechat/WebAppService.php b/src/service/wechat/WebAppService.php index dad10e6..32a320b 100644 --- a/src/service/wechat/WebAppService.php +++ b/src/service/wechat/WebAppService.php @@ -134,9 +134,9 @@ class WebAppService extends Service */ private function getConfig() { - $this->cache = $this->app->config->get('dtapp.wechat.webapp.cache'); - $this->app_id = $this->app->config->get('dtapp.wechat.webapp.app_id'); - $this->app_secret = $this->app->config->get('dtapp.wechat.webapp.app_secret'); + $this->cache = config('dtapp.wechat.webapp.cache'); + $this->app_id = config('dtapp.wechat.webapp.app_id'); + $this->app_secret = config('dtapp.wechat.webapp.app_secret'); return $this; }