- 优化代码

v6 v6.0.90
Chaim 4 years ago
parent 52a3dbc7f7
commit 9f18bb66d1

@ -1,3 +1,6 @@
## v6.0.90 / 2020-07-18
- 优化代码
## v6.0.89 / 2020-07-18 ## v6.0.89 / 2020-07-18
- 修复获取配置问题 - 修复获取配置问题

@ -197,27 +197,23 @@ class ApiController extends stdClass
*/ */
public function _judgeSign($name = 'sniff_h5') public function _judgeSign($name = 'sniff_h5')
{ {
if (empty($this->request->header('sign', ''))) { // 加密的数据参数
$aes = $this->request->post('aes', '');
if (empty($aes)) {
$this->error('数据未签名!', 104); $this->error('数据未签名!', 104);
} }
// 加密的数据参数
$aes = $this->request->post('aes');
// 获取时间数据 // 获取时间数据
$timestamp = $this->request->get('timestamp', 0); $timestamp = $this->request->get('timestamp', 0);
// 判断是否有时间 // 判断是否有时间
if (empty($timestamp)) { if (empty($timestamp)) {
$this->error('数据异常!', 105); $this->error('数据异常!', 105);
} }
// 解密 // 解密
$aes_decode = $this->decrypt($aes, $name, $timestamp); $aes_decode = $this->decrypt($aes, $name, $timestamp);
if (empty($aes_decode)) { if (empty($aes_decode)) {
$this->error('解密失败', 106); $this->error('解密失败', 106);
} }
$data = json_decode($aes_decode, true); $data = json_decode($aes_decode, true);
// 判断是不是小于服务器时间 // 判断是不是小于服务器时间
$before = strtotime('-2minute'); $before = strtotime('-2minute');
$rear = strtotime('+2minute'); $rear = strtotime('+2minute');

@ -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')) { if (!function_exists('get_ip_info')) {
/** /**

@ -58,7 +58,7 @@ class StorageService extends Service
*/ */
private function getConfig() private function getConfig()
{ {
$this->path = $this->app->config->get('dtapp.storage.path'); $this->path = config('dtapp.storage.path');
return $this; return $this;
} }

@ -40,12 +40,12 @@ class SystemService extends Service
*/ */
public function uri($url = '', array $vars = [], $suffix = true, $domain = false, $fillSuffix = false) public function uri($url = '', array $vars = [], $suffix = true, $domain = false, $fillSuffix = false)
{ {
$default_app = $this->app->config->get('app.default_app', 'index'); $default_app = config('app.default_app', 'index');
$default_action = $this->app->config->get('route.default_action', 'index'); $default_action = config('route.default_action', 'index');
$default_controller = $this->app->config->get('route.default_controller', 'Index'); $default_controller = config('route.default_controller', 'Index');
$url_html_suffix = $this->app->config->get('route.url_html_suffix', 'html'); $url_html_suffix = config('route.url_html_suffix', 'html');
$pathinfo_depr = $this->app->config->get('route.pathinfo_depr', '/'); $pathinfo_depr = config('route.pathinfo_depr', '/');
$url_common_param = $this->app->config->get('route.url_common_param', true); $url_common_param = config('route.url_common_param', true);
if (empty($url)) { if (empty($url)) {
$url = "{$default_app}/{$default_action}/{$default_controller}"; $url = "{$default_app}/{$default_action}/{$default_controller}";
} }

@ -63,10 +63,10 @@ class OssService extends Service
*/ */
private function getConfig() private function getConfig()
{ {
$this->accessKeyId = $this->app->config->get('dtapp.aliyun.oss.access_key_id'); $this->accessKeyId = config('dtapp.aliyun.oss.access_key_id');
$this->accessKeySecret = $this->app->config->get('dtapp.aliyun.oss.access_key_secret'); $this->accessKeySecret = config('dtapp.aliyun.oss.access_key_secret');
$this->endpoint = $this->app->config->get('dtapp.aliyun.oss.endpoint'); $this->endpoint = config('dtapp.aliyun.oss.endpoint');
$this->bucket = $this->app->config->get('dtapp.aliyun.oss.bucket'); $this->bucket = config('dtapp.aliyun.oss.bucket');
return $this; return $this;
} }
@ -84,7 +84,7 @@ class OssService extends Service
try { try {
$ossClient = new OssClient($this->accessKeyId, $this->accessKeySecret, $this->endpoint); $ossClient = new OssClient($this->accessKeyId, $this->accessKeySecret, $this->endpoint);
$ossClient->uploadFile($this->bucket, $object, $filePath); $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) { } catch (OssException $e) {
return $e->getMessage(); return $e->getMessage();
} }

@ -63,10 +63,10 @@ class BosService extends Service
*/ */
private function getConfig() private function getConfig()
{ {
$this->accessKeyId = $this->app->config->get('dtapp.baidu.bos.access_key_id'); $this->accessKeyId = config('dtapp.baidu.bos.access_key_id');
$this->secretAccessKey = $this->app->config->get('dtapp.baidu.bos.secret_access_key'); $this->secretAccessKey = config('dtapp.baidu.bos.secret_access_key');
$this->endpoint = $this->app->config->get('dtapp.baidu.bos.endpoint'); $this->endpoint = config('dtapp.baidu.bos.endpoint');
$this->bucket = $this->app->config->get('dtapp.baidu.bos.bucket'); $this->bucket = config('dtapp.baidu.bos.bucket');
return $this; return $this;
} }
@ -96,6 +96,6 @@ class BosService extends Service
$this->getConfig(); $this->getConfig();
} }
$client->putObjectFromFile($this->bucket, $object, $filePath); $client->putObjectFromFile($this->bucket, $object, $filePath);
return $this->app->config->get('dtapp.baidu.bos.url', '') . $object; return config('dtapp.baidu.bos.url', '') . $object;
} }
} }

@ -57,8 +57,8 @@ class ApiService extends Service
*/ */
private function getConfig() private function getConfig()
{ {
$this->key = $this->app->config->get('dtapp.bt.key'); $this->key = config('dtapp.bt.key');
$this->panel = $this->app->config->get('dtapp.bt.panel'); $this->panel = config('dtapp.bt.panel');
return $this; return $this;
} }

@ -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"); ->upload($yun_path . $backtrack['video_info']['vid'] . "_playwm" . ".mp4", $system_path . $backtrack['video_info']['vid'] . "_playwm" . ".mp4");
break; break;
case "storage": case "storage":
$domain_name = $this->app->config->get('dtapp.storage.domain_name'); $domain_name = config('dtapp.storage.domain_name');
$new_yun_path = $this->app->config->get("dtapp.storage.domain_list.{$domain_name}") . "upload/watermark/{$yun_path}"; $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"; $backtrack['yun']['author_info']['avatar'] = "{$new_yun_path}" . $backtrack['author_info']['uid'] . ".jpeg";

@ -62,10 +62,10 @@ class ObsService extends Service
*/ */
private function getConfig() private function getConfig()
{ {
$this->key = $this->app->config->get('dtapp.huaweicloud.obs.key'); $this->key = config('dtapp.huaweicloud.obs.key');
$this->secret = $this->app->config->get('dtapp.huaweicloud.obs.secret'); $this->secret = config('dtapp.huaweicloud.obs.secret');
$this->endpoint = $this->app->config->get('dtapp.huaweicloud.obs.endpoint'); $this->endpoint = config('dtapp.huaweicloud.obs.endpoint');
$this->bucket = $this->app->config->get('dtapp.huaweicloud.obs.bucket'); $this->bucket = config('dtapp.huaweicloud.obs.bucket');
return $this; return $this;
} }
@ -95,7 +95,7 @@ class ObsService extends Service
'SourceFile' => $filePath // localfile为待上传的本地文件路径需要指定到具体的文件名 'SourceFile' => $filePath // localfile为待上传的本地文件路径需要指定到具体的文件名
]); ]);
if (isset($resp['RequestId'])) { if (isset($resp['RequestId'])) {
return $this->app->config->get('dtapp.huaweicloud.obs.url', '') . $object; return config('dtapp.huaweicloud.obs.url', '') . $object;
} else { } else {
return false; return false;
} }

@ -158,8 +158,8 @@ class UnionService extends Service
*/ */
private function getConfig() private function getConfig()
{ {
$this->app_key = $this->app->config->get('dtapp.jd.union.app_key'); $this->app_key = config('dtapp.jd.union.app_key');
$this->secret_key = $this->app->config->get('dtapp.jd.union.secret_key'); $this->secret_key = config('dtapp.jd.union.secret_key');
return $this; return $this;
} }

@ -63,10 +63,10 @@ class Ks3Service extends Service
*/ */
private function getConfig() private function getConfig()
{ {
$this->accessKeyID = $this->app->config->get('dtapp.ksyun.ks3.access_key_iD'); $this->accessKeyID = config('dtapp.ksyun.ks3.access_key_iD');
$this->accessKeySecret = $this->app->config->get('dtapp.ksyun.ks3.access_key_secret'); $this->accessKeySecret = config('dtapp.ksyun.ks3.access_key_secret');
$this->endpoint = $this->app->config->get('dtapp.ksyun.ks3.endpoint'); $this->endpoint = config('dtapp.ksyun.ks3.endpoint');
$this->bucket = $this->app->config->get('dtapp.ksyun.ks3.bucket'); $this->bucket = config('dtapp.ksyun.ks3.bucket');
return $this; return $this;
} }
@ -108,7 +108,7 @@ class Ks3Service extends Service
]; ];
try { try {
$client->putObjectByFile($args); $client->putObjectByFile($args);
return $this->app->config->get('dtapp.ksyun.ks3.url', '') . $object; return config('dtapp.ksyun.ks3.url', '') . $object;
} catch (Ks3ServiceException $e) { } catch (Ks3ServiceException $e) {
return false; return false;
} }

@ -152,8 +152,8 @@ class JinBaoService extends Service
*/ */
private function getConfig() private function getConfig()
{ {
$this->client_id = $this->app->config->get('dtapp.pinduoduo.jinbao.client_id'); $this->client_id = config('dtapp.pinduoduo.jinbao.client_id');
$this->client_secret = $this->app->config->get('dtapp.pinduoduo.jinbao.client_secret'); $this->client_secret = config('dtapp.pinduoduo.jinbao.client_secret');
return $this; return $this;
} }

@ -58,9 +58,9 @@ class KodoService extends Service
*/ */
private function getConfig() private function getConfig()
{ {
$this->accessKey = $this->app->config->get('dtapp.qiniu.kodo.access_key'); $this->accessKey = config('dtapp.qiniu.kodo.access_key');
$this->secretKey = $this->app->config->get('dtapp.qiniu.kodo.secret_key'); $this->secretKey = config('dtapp.qiniu.kodo.secret_key');
$this->bucket = $this->app->config->get('dtapp.qiniu.kodo.bucket'); $this->bucket = config('dtapp.qiniu.kodo.bucket');
return $this; return $this;
} }
@ -87,7 +87,7 @@ class KodoService extends Service
if ($err !== null) { if ($err !== null) {
return false; return false;
} else { } else {
return $this->app->config->get('dtapp.qiniu.kodo.url', '') . $object; return config('dtapp.qiniu.kodo.url', '') . $object;
} }
} }
} }

@ -146,8 +146,8 @@ class TbkService extends Service
*/ */
private function getConfig() private function getConfig()
{ {
$this->app_key = $this->app->config->get('dtapp.taobao.tbk.app_key'); $this->app_key = config('dtapp.taobao.tbk.app_key');
$this->app_secret = $this->app->config->get('dtapp.taobao.tbk.app_secret'); $this->app_secret = config('dtapp.taobao.tbk.app_secret');
return $this; return $this;
} }

@ -63,10 +63,10 @@ class CosService extends Service
*/ */
private function getConfig() private function getConfig()
{ {
$this->secretId = $this->app->config->get('dtapp.tencent.cos.secret_id'); $this->secretId = config('dtapp.tencent.cos.secret_id');
$this->secretKey = $this->app->config->get('dtapp.tencent.cos.secret_key'); $this->secretKey = config('dtapp.tencent.cos.secret_key');
$this->region = $this->app->config->get('dtapp.tencent.cos.region'); $this->region = config('dtapp.tencent.cos.region');
$this->bucket = $this->app->config->get('dtapp.tencent.cos.bucket'); $this->bucket = config('dtapp.tencent.cos.bucket');
return $this; 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;
} }
} }

@ -58,9 +58,9 @@ class UssService extends Service
*/ */
private function getConfig() private function getConfig()
{ {
$this->serviceName = $this->app->config->get('dtapp.upyun.uss.service_name'); $this->serviceName = config('dtapp.upyun.uss.service_name');
$this->operatorName = $this->app->config->get('dtapp.upyun.uss.operator_name'); $this->operatorName = config('dtapp.upyun.uss.operator_name');
$this->operatorPassword = $this->app->config->get('dtapp.upyun.uss.operator_password'); $this->operatorPassword = config('dtapp.upyun.uss.operator_password');
return $this; return $this;
} }
@ -80,6 +80,6 @@ class UssService extends Service
$client = new Upyun($serviceConfig); $client = new Upyun($serviceConfig);
$file = fopen($filePath, 'r'); $file = fopen($filePath, 'r');
$client->write($object, $file); $client->write($object, $file);
return $this->app->config->get('dtapp.upyun.uss.url', '') . $object; return config('dtapp.upyun.uss.url', '') . $object;
} }
} }

@ -81,9 +81,9 @@ class MiniService extends Service
*/ */
private function getConfig() private function getConfig()
{ {
$this->cache = $this->app->config->get('dtapp.wechat.mini.cache'); $this->cache = config('dtapp.wechat.mini.cache');
$this->app_id = $this->app->config->get('dtapp.wechat.mini.app_id'); $this->app_id = config('dtapp.wechat.mini.app_id');
$this->app_secret = $this->app->config->get('dtapp.wechat.mini.app_secret'); $this->app_secret = config('dtapp.wechat.mini.app_secret');
return $this; return $this;
} }

@ -134,9 +134,9 @@ class WebAppService extends Service
*/ */
private function getConfig() private function getConfig()
{ {
$this->cache = $this->app->config->get('dtapp.wechat.webapp.cache'); $this->cache = config('dtapp.wechat.webapp.cache');
$this->app_id = $this->app->config->get('dtapp.wechat.webapp.app_id'); $this->app_id = config('dtapp.wechat.webapp.app_id');
$this->app_secret = $this->app->config->get('dtapp.wechat.webapp.app_secret'); $this->app_secret = config('dtapp.wechat.webapp.app_secret');
return $this; return $this;
} }

Loading…
Cancel
Save