@@ -95,7 +95,7 @@ |
||
| 95 | 95 | 'SourceFile' => $filePath // localfile为待上传的本地文件路径,需要指定到具体的文件名 |
| 96 | 96 | ]); |
| 97 | 97 | if (isset($resp['RequestId'])) { |
| 98 | - return config('dtapp.huaweicloud.obs.url', '') . $object; |
|
| 98 | + return config('dtapp.huaweicloud.obs.url', '').$object; |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | return false; |
@@ -88,6 +88,6 @@ |
||
| 88 | 88 | return false; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - return config('dtapp.qiniu.kodo.url', '') . $object; |
|
| 91 | + return config('dtapp.qiniu.kodo.url', '').$object; |
|
| 92 | 92 | } |
| 93 | 93 | } |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | $this->getHttp(); |
| 360 | 360 | if ($this->where['type'] == 'sites') { |
| 361 | 361 | $this->getDataWithOrderOpt(); |
| 362 | - } else { |
|
| 362 | + }else { |
|
| 363 | 363 | $this->getDataWithCount(); |
| 364 | 364 | } |
| 365 | 365 | if (empty($this->backtrack)) { |
@@ -378,9 +378,9 @@ discard block |
||
| 378 | 378 | */ |
| 379 | 379 | private function mimes($name): string |
| 380 | 380 | { |
| 381 | - $mimes = include __DIR__ . '/bin/mimes.php'; |
|
| 381 | + $mimes = include __DIR__.'/bin/mimes.php'; |
|
| 382 | 382 | if (isset($mimes[$name])) { |
| 383 | - return '/' . $mimes[$name]; |
|
| 383 | + return '/'.$mimes[$name]; |
|
| 384 | 384 | } |
| 385 | 385 | return ''; |
| 386 | 386 | } |
@@ -402,8 +402,8 @@ discard block |
||
| 402 | 402 | throw new DtaException('请检查panel参数'); |
| 403 | 403 | } |
| 404 | 404 | //定义cookie保存位置 |
| 405 | - $file = app()->getRootPath() . 'runtime/dtapp/bt/cookie/'; |
|
| 406 | - $cookie_file = $file . md5($this->panel) . '.cookie'; |
|
| 405 | + $file = app()->getRootPath().'runtime/dtapp/bt/cookie/'; |
|
| 406 | + $cookie_file = $file.md5($this->panel).'.cookie'; |
|
| 407 | 407 | if (empty(Files::judgeContents($file)) && !mkdir($file, 0777, true) && !is_dir($file)) { |
| 408 | 408 | throw new \RuntimeException(sprintf('Directory "%s" was not created', $file)); |
| 409 | 409 | } |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | { |
| 436 | 436 | $start = strpos($str, "共"); |
| 437 | 437 | $end = strpos($str, "条数据"); |
| 438 | - $count = substr($str, $start + 3, $end - $start - 3); |
|
| 438 | + $count = substr($str, $start+3, $end-$start-3); |
|
| 439 | 439 | if (empty($count)) { |
| 440 | 440 | return 0; |
| 441 | 441 | } |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | $this->scope = $scope; |
| 166 | 166 | } elseif ($scope === "snsapi_userinfo") { |
| 167 | 167 | $this->scope = $scope; |
| 168 | - } else { |
|
| 168 | + }else { |
|
| 169 | 169 | throw new DtaException("请检查scope参数"); |
| 170 | 170 | } |
| 171 | 171 | return $this; |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | // 获取数据 |
| 314 | 314 | $accessToken = $this->getAccessToken(); |
| 315 | 315 | if (!isset($accessToken['access_token'])) { |
| 316 | - throw new DtaException("获取access_token错误," . $accessToken['errmsg']); |
|
| 316 | + throw new DtaException("获取access_token错误,".$accessToken['errmsg']); |
|
| 317 | 317 | } |
| 318 | 318 | $res = HttpService::instance() |
| 319 | 319 | ->url("{$this->api_url}cgi-bin/ticket/getticket?access_token={$accessToken['access_token']}&type=jsapi") |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | // 获取数据 |
| 323 | 323 | $accessToken = $this->getAccessToken(); |
| 324 | 324 | if (!isset($accessToken['access_token'])) { |
| 325 | - throw new DtaException("获取access_token错误," . $accessToken['errmsg']); |
|
| 325 | + throw new DtaException("获取access_token错误,".$accessToken['errmsg']); |
|
| 326 | 326 | } |
| 327 | 327 | $res = HttpService::instance() |
| 328 | 328 | ->url("{$this->api_url}cgi-bin/ticket/getticket?access_token={$accessToken['access_token']}&type=jsapi") |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; |
| 356 | 356 | $str = ""; |
| 357 | 357 | for ($i = 0; $i < $length; $i++) { |
| 358 | - $str .= $chars[random_int(0, strlen($chars) - 1)]; |
|
| 358 | + $str .= $chars[random_int(0, strlen($chars)-1)]; |
|
| 359 | 359 | } |
| 360 | 360 | return $str; |
| 361 | 361 | } |
@@ -627,22 +627,22 @@ discard block |
||
| 627 | 627 | $accessToken_res = HttpService::instance() |
| 628 | 628 | ->url("{$this->api_url}cgi-bin/token?grant_type={$this->grant_type}&appid={$this->app_id}&secret={$this->app_secret}") |
| 629 | 629 | ->toArray(); |
| 630 | - $accessToken_res['expires_time'] = time() + 6000; |
|
| 630 | + $accessToken_res['expires_time'] = time()+6000; |
|
| 631 | 631 | file_put_contents($file, json_encode($accessToken_res, JSON_UNESCAPED_UNICODE)); |
| 632 | 632 | $accessToken = $accessToken_res; |
| 633 | - } else if (!isset($accessToken['access_token'])) { |
|
| 633 | + }else if (!isset($accessToken['access_token'])) { |
|
| 634 | 634 | // 内容不存在 |
| 635 | 635 | $accessToken_res = HttpService::instance() |
| 636 | 636 | ->url("{$this->api_url}cgi-bin/token?grant_type={$this->grant_type}&appid={$this->app_id}&secret={$this->app_secret}") |
| 637 | 637 | ->toArray(); |
| 638 | - $accessToken_res['expires_time'] = time() + 6000; |
|
| 638 | + $accessToken_res['expires_time'] = time()+6000; |
|
| 639 | 639 | file_put_contents($file, json_encode($accessToken_res, JSON_UNESCAPED_UNICODE)); |
| 640 | 640 | $accessToken = $accessToken_res; |
| 641 | - } else if ($accessToken['expires_time'] <= time()) { |
|
| 641 | + }else if ($accessToken['expires_time'] <= time()) { |
|
| 642 | 642 | $accessToken_res = HttpService::instance() |
| 643 | 643 | ->url("{$this->api_url}cgi-bin/token?grant_type={$this->grant_type}&appid={$this->app_id}&secret={$this->app_secret}") |
| 644 | 644 | ->toArray(); |
| 645 | - $accessToken_res['expires_time'] = time() + 6000; |
|
| 645 | + $accessToken_res['expires_time'] = time()+6000; |
|
| 646 | 646 | file_put_contents($file, json_encode($accessToken_res, JSON_UNESCAPED_UNICODE)); |
| 647 | 647 | $accessToken = $accessToken_res; |
| 648 | 648 | } |
@@ -653,12 +653,12 @@ discard block |
||
| 653 | 653 | $accessToken_res = HttpService::instance() |
| 654 | 654 | ->url("{$this->api_url}cgi-bin/token?grant_type={$this->grant_type}&appid={$this->app_id}&secret={$this->app_secret}") |
| 655 | 655 | ->toArray(); |
| 656 | - $accessToken_res['expires_time'] = time() + 6000; |
|
| 656 | + $accessToken_res['expires_time'] = time()+6000; |
|
| 657 | 657 | file_put_contents($file, json_encode($accessToken_res, JSON_UNESCAPED_UNICODE)); |
| 658 | 658 | $accessToken = $accessToken_res; |
| 659 | 659 | } |
| 660 | 660 | return $accessToken; |
| 661 | - } else if ($this->cache == "mysql") { |
|
| 661 | + }else if ($this->cache == "mysql") { |
|
| 662 | 662 | $access_token = []; |
| 663 | 663 | // 文件名 |
| 664 | 664 | $file = "{$this->app_id}_access_token"; |
@@ -666,7 +666,7 @@ discard block |
||
| 666 | 666 | $cache_mysql_value = dtacache($file); |
| 667 | 667 | if (!empty($cache_mysql_value)) { |
| 668 | 668 | $access_token['access_token'] = $cache_mysql_value; |
| 669 | - } else { |
|
| 669 | + }else { |
|
| 670 | 670 | // 获取远程Token |
| 671 | 671 | $accessToken_res = HttpService::instance() |
| 672 | 672 | ->url("{$this->api_url}cgi-bin/token?grant_type={$this->grant_type}&appid={$this->app_id}&secret={$this->app_secret}") |
@@ -687,7 +687,7 @@ discard block |
||
| 687 | 687 | $access_token['access_token'] = $accessToken_res['access_token']; |
| 688 | 688 | } |
| 689 | 689 | return $access_token; |
| 690 | - } else { |
|
| 690 | + }else { |
|
| 691 | 691 | throw new DtaException("驱动方式错误"); |
| 692 | 692 | } |
| 693 | 693 | } |
@@ -738,11 +738,11 @@ discard block |
||
| 738 | 738 | // 转成字符串 |
| 739 | 739 | $stringA = Urls::toParams($array); |
| 740 | 740 | // 在字符串接商户支付秘钥 |
| 741 | - $stringSignTemp = "{$stringA}&key=" . $this->mch_key; |
|
| 741 | + $stringSignTemp = "{$stringA}&key=".$this->mch_key; |
|
| 742 | 742 | //步骤四:MD5或HMAC-SHA256C加密 |
| 743 | 743 | if ($hmacsha256) { |
| 744 | 744 | $str = hash_hmac("sha256", $stringSignTemp, $this->mch_key); |
| 745 | - } else { |
|
| 745 | + }else { |
|
| 746 | 746 | $str = md5($stringSignTemp); |
| 747 | 747 | } |
| 748 | 748 | //符转大写 |
@@ -762,8 +762,8 @@ discard block |
||
| 762 | 762 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); |
| 763 | 763 | |
| 764 | 764 | //试试手气新增,增加之后 curl 不报 60# 错误,可以请求到微信的响应 |
| 765 | - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //不验证 SSL 证书 |
|
| 766 | - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);//不验证 SSL 证书域名 |
|
| 765 | + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //不验证 SSL 证书 |
|
| 766 | + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); //不验证 SSL 证书域名 |
|
| 767 | 767 | //post提交方式 |
| 768 | 768 | curl_setopt($ch, CURLOPT_POST, TRUE); |
| 769 | 769 | curl_setopt($ch, CURLOPT_POSTFIELDS, $xml); |
@@ -773,10 +773,10 @@ discard block |
||
| 773 | 773 | if ($data) { |
| 774 | 774 | curl_close($ch); |
| 775 | 775 | return $data; |
| 776 | - } else { |
|
| 776 | + }else { |
|
| 777 | 777 | $error = curl_errno($ch); |
| 778 | 778 | curl_close($ch); |
| 779 | - return "curl error, error code " . $error; |
|
| 779 | + return "curl error, error code ".$error; |
|
| 780 | 780 | } |
| 781 | 781 | } |
| 782 | 782 | } |
@@ -103,6 +103,6 @@ |
||
| 103 | 103 | 'Body' => $file) |
| 104 | 104 | ); |
| 105 | 105 | } |
| 106 | - return config('dtapp.tencent.cos.url', '') . $object; |
|
| 106 | + return config('dtapp.tencent.cos.url', '').$object; |
|
| 107 | 107 | } |
| 108 | 108 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | public function read(string $sessionId): string |
| 55 | 55 | { |
| 56 | 56 | return (string)Db::table($this->table_name) |
| 57 | - ->where('session_id', $this->config['session_prefix'] . $sessionId) |
|
| 57 | + ->where('session_id', $this->config['session_prefix'].$sessionId) |
|
| 58 | 58 | ->whereTime('session_expire', '>=', time()) |
| 59 | 59 | ->order('session_expire desc') |
| 60 | 60 | ->value('session_data', ''); |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | public function delete(string $sessionId): bool |
| 70 | 70 | { |
| 71 | 71 | $result = Db::table($this->table_name) |
| 72 | - ->where('session_id', $this->config['session_prefix'] . $sessionId) |
|
| 72 | + ->where('session_id', $this->config['session_prefix'].$sessionId) |
|
| 73 | 73 | ->delete(); |
| 74 | 74 | return $result ? true : false; |
| 75 | 75 | } |
@@ -86,13 +86,13 @@ discard block |
||
| 86 | 86 | public function write(string $sessionId, string $data): bool |
| 87 | 87 | { |
| 88 | 88 | $get = Db::table($this->table_name) |
| 89 | - ->where('session_id', $this->config['session_prefix'] . $sessionId) |
|
| 89 | + ->where('session_id', $this->config['session_prefix'].$sessionId) |
|
| 90 | 90 | ->whereTime('session_expire', '>=', time()) |
| 91 | 91 | ->field('id') |
| 92 | 92 | ->find(); |
| 93 | 93 | if (empty($get)) { |
| 94 | 94 | $params = [ |
| 95 | - 'session_id' => $this->config['session_prefix'] . $sessionId, |
|
| 95 | + 'session_id' => $this->config['session_prefix'].$sessionId, |
|
| 96 | 96 | 'session_expire' => Times::dateRear("Y-m-d H:i:s", $this->config['session_expire']), |
| 97 | 97 | 'session_data' => $data |
| 98 | 98 | ]; |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | $rear = strtotime('+2minute'); |
| 225 | 225 | if ($timestamp <= $rear && $timestamp >= $before) { |
| 226 | 226 | $this->aes_decrypt_data = $data; |
| 227 | - } else { |
|
| 227 | + }else { |
|
| 228 | 228 | $this->error('已超时,请重新尝试!'); |
| 229 | 229 | } |
| 230 | 230 | } |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | if (!empty(is_array($data))) { |
| 247 | 247 | $data = json_encode($data); |
| 248 | 248 | } |
| 249 | - return urlencode(base64_encode(openssl_encrypt($data, 'AES-128-CBC', $this->aes_md5, 1, $this->aes_md5_iv . $timestamp))); |
|
| 249 | + return urlencode(base64_encode(openssl_encrypt($data, 'AES-128-CBC', $this->aes_md5, 1, $this->aes_md5_iv.$timestamp))); |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | /** |
@@ -263,6 +263,6 @@ discard block |
||
| 263 | 263 | if (empty($this->aes_md5_iv)) { |
| 264 | 264 | $this->setAesMd5Iv(); |
| 265 | 265 | } |
| 266 | - return openssl_decrypt(base64_decode(urldecode($data)), "AES-128-CBC", $this->aes_md5, true, $this->aes_md5_iv . $timestamp); |
|
| 266 | + return openssl_decrypt(base64_decode(urldecode($data)), "AES-128-CBC", $this->aes_md5, true, $this->aes_md5_iv.$timestamp); |
|
| 267 | 267 | } |
| 268 | 268 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | // | Packagist 地址 :https://packagist.org/packages/liguangchun/think-library |
| 18 | 18 | // +---------------------------------------------------------------------- |
| 19 | 19 | |
| 20 | -declare (strict_types=1); |
|
| 20 | +declare(strict_types=1); |
|
| 21 | 21 | |
| 22 | 22 | namespace DtApp\ThinkLibrary\helper; |
| 23 | 23 | |
@@ -51,10 +51,10 @@ discard block |
||
| 51 | 51 | if ((int)$type === 3) { |
| 52 | 52 | $chars = "{$numbs}{$chars}"; |
| 53 | 53 | } |
| 54 | - $string = $prefix . $chars[random_int(1, strlen($chars) - 1)]; |
|
| 54 | + $string = $prefix.$chars[random_int(1, strlen($chars)-1)]; |
|
| 55 | 55 | if (isset($chars)) { |
| 56 | 56 | while (strlen($string) < $size) { |
| 57 | - $string .= $chars[random_int(0, strlen($chars) - 1)]; |
|
| 57 | + $string .= $chars[random_int(0, strlen($chars)-1)]; |
|
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | return $string; |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | if ($size < 14) { |
| 73 | 73 | $size = 14; |
| 74 | 74 | } |
| 75 | - $string = $prefix . date('Ymd') . (date('H') + date('i')) . date('s'); |
|
| 75 | + $string = $prefix.date('Ymd').(date('H')+date('i')).date('s'); |
|
| 76 | 76 | while (strlen($string) < $size) { |
| 77 | 77 | $string .= random_int(0, 9); |
| 78 | 78 | } |
@@ -88,11 +88,11 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | public function number($size = 12, $prefix = ''): string |
| 90 | 90 | { |
| 91 | - $time = time() . ''; |
|
| 91 | + $time = time().''; |
|
| 92 | 92 | if ($size < 10) { |
| 93 | 93 | $size = 10; |
| 94 | 94 | } |
| 95 | - $string = $prefix . ($time[0] . $time[1]) . substr($time, 2) . random_int(0, 9); |
|
| 95 | + $string = $prefix.($time[0].$time[1]).substr($time, 2).random_int(0, 9); |
|
| 96 | 96 | while (strlen($string) < $size) { |
| 97 | 97 | $string .= random_int(0, 9); |
| 98 | 98 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | // | Packagist 地址 :https://packagist.org/packages/liguangchun/think-library |
| 18 | 18 | // +---------------------------------------------------------------------- |
| 19 | 19 | |
| 20 | -declare (strict_types=1); |
|
| 20 | +declare(strict_types=1); |
|
| 21 | 21 | |
| 22 | 22 | namespace DtApp\ThinkLibrary\helper; |
| 23 | 23 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public function extractBefore(string $str, int $start_num, int $end_num): string |
| 39 | 39 | { |
| 40 | - if (strlen($str) < $start_num + $end_num) { |
|
| 40 | + if (strlen($str) < $start_num+$end_num) { |
|
| 41 | 41 | return $str; |
| 42 | 42 | } |
| 43 | 43 | return substr($str, $start_num, $end_num); |