@@ -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 | |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | $dh = opendir($name); |
68 | 68 | while ($file = readdir($dh)) { |
69 | 69 | if ($file != "." && $file != "..") { |
70 | - $fullpath = $name . "/" . $file; |
|
70 | + $fullpath = $name."/".$file; |
|
71 | 71 | if (!is_dir($fullpath)) { |
72 | 72 | unlink($fullpath); |
73 | - } else { |
|
73 | + }else { |
|
74 | 74 | $this->deletes($fullpath); |
75 | 75 | } |
76 | 76 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | if (empty($name)) { |
98 | 98 | throw new DtaException('请检查需要打包的路径名称'); |
99 | 99 | } |
100 | - $list = glob($name . "{$file_name}.{$suffix_name}"); |
|
100 | + $list = glob($name."{$file_name}.{$suffix_name}"); |
|
101 | 101 | $fileList = $list; |
102 | 102 | $zip = new ZipArchive(); |
103 | 103 | // 打开压缩包 |
@@ -120,13 +120,13 @@ discard block |
||
120 | 120 | { |
121 | 121 | $files = []; |
122 | 122 | if (is_dir($path)) { |
123 | - $path = dirname($path) . '/' . basename($path) . '/'; |
|
123 | + $path = dirname($path).'/'.basename($path).'/'; |
|
124 | 124 | $file = dir($path); |
125 | 125 | while (false !== ($entry = $file->read())) { |
126 | 126 | if ($entry !== '.' && $entry !== '..') { |
127 | - $cur = $path . $entry; |
|
127 | + $cur = $path.$entry; |
|
128 | 128 | if (is_dir($cur)) { |
129 | - $subPath = $cur . '/'; |
|
129 | + $subPath = $cur.'/'; |
|
130 | 130 | $this->getFiles($subPath); |
131 | 131 | } |
132 | 132 | $files[] = $cur; |
@@ -17,7 +17,7 @@ |
||
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 |
@@ -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 | |
@@ -58,13 +58,13 @@ discard block |
||
58 | 58 | $charset = array_merge($lowerLetter, $upperLetter); |
59 | 59 | } elseif ($type == 7) { |
60 | 60 | $charset = array_merge($number, $lowerLetter, $upperLetter); |
61 | - } else { |
|
61 | + }else { |
|
62 | 62 | $charset = $number; |
63 | 63 | } |
64 | 64 | $str = ''; |
65 | 65 | // 生成字符串 |
66 | 66 | for ($i = 0; $i < $length; $i++) { |
67 | - $str .= $charset[random_int(0, count($charset) - 1)]; |
|
67 | + $str .= $charset[random_int(0, count($charset)-1)]; |
|
68 | 68 | // 验证规则 |
69 | 69 | if ($type == 4 && strlen($str) >= 2) { |
70 | 70 | if (!preg_match('/\d+/', $str) || !preg_match('/[a-z]+/', $str)) { |
@@ -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 | } |
@@ -654,15 +654,15 @@ discard block |
||
654 | 654 | $accessToken_res = HttpService::instance() |
655 | 655 | ->url("{$this->api_url}cgi-bin/token?grant_type={$this->grant_type}&appid={$this->app_id}&secret={$this->app_secret}") |
656 | 656 | ->toArray(); |
657 | - $accessToken_res['expires_time'] = time() + 6000; |
|
657 | + $accessToken_res['expires_time'] = time()+6000; |
|
658 | 658 | file_put_contents($file, json_encode($accessToken_res, JSON_UNESCAPED_UNICODE)); |
659 | 659 | $accessToken = $accessToken_res; |
660 | 660 | } |
661 | - } else { |
|
661 | + }else { |
|
662 | 662 | $accessToken_res = HttpService::instance() |
663 | 663 | ->url("{$this->api_url}cgi-bin/token?grant_type={$this->grant_type}&appid={$this->app_id}&secret={$this->app_secret}") |
664 | 664 | ->toArray(); |
665 | - $accessToken_res['expires_time'] = time() + 6000; |
|
665 | + $accessToken_res['expires_time'] = time()+6000; |
|
666 | 666 | file_put_contents($file, json_encode($accessToken_res, JSON_UNESCAPED_UNICODE)); |
667 | 667 | $accessToken = $accessToken_res; |
668 | 668 | } |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | $cache_mysql_value = dtacache($file); |
678 | 678 | if (!empty($cache_mysql_value)) { |
679 | 679 | $access_token['access_token'] = $cache_mysql_value; |
680 | - } else { |
|
680 | + }else { |
|
681 | 681 | // 获取远程Token |
682 | 682 | $accessToken_res = HttpService::instance() |
683 | 683 | ->url("{$this->api_url}cgi-bin/token?grant_type={$this->grant_type}&appid={$this->app_id}&secret={$this->app_secret}") |
@@ -749,11 +749,11 @@ discard block |
||
749 | 749 | // 转成字符串 |
750 | 750 | $stringA = Urls::toParams($array); |
751 | 751 | // 在字符串接商户支付秘钥 |
752 | - $stringSignTemp = "{$stringA}&key=" . $this->mch_key; |
|
752 | + $stringSignTemp = "{$stringA}&key=".$this->mch_key; |
|
753 | 753 | //步骤四:MD5或HMAC-SHA256C加密 |
754 | 754 | if ($hmacsha256) { |
755 | 755 | $str = hash_hmac("sha256", $stringSignTemp, $this->mch_key); |
756 | - } else { |
|
756 | + }else { |
|
757 | 757 | $str = md5($stringSignTemp); |
758 | 758 | } |
759 | 759 | //符转大写 |
@@ -773,8 +773,8 @@ discard block |
||
773 | 773 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); |
774 | 774 | |
775 | 775 | //试试手气新增,增加之后 curl 不报 60# 错误,可以请求到微信的响应 |
776 | - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //不验证 SSL 证书 |
|
777 | - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);//不验证 SSL 证书域名 |
|
776 | + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //不验证 SSL 证书 |
|
777 | + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); //不验证 SSL 证书域名 |
|
778 | 778 | //post提交方式 |
779 | 779 | curl_setopt($ch, CURLOPT_POST, TRUE); |
780 | 780 | curl_setopt($ch, CURLOPT_POSTFIELDS, $xml); |
@@ -788,6 +788,6 @@ discard block |
||
788 | 788 | |
789 | 789 | $error = curl_errno($ch); |
790 | 790 | curl_close($ch); |
791 | - return "curl error, error code " . $error; |
|
791 | + return "curl error, error code ".$error; |
|
792 | 792 | } |
793 | 793 | } |
@@ -137,9 +137,9 @@ discard block |
||
137 | 137 | $sign = $this->createSign(); |
138 | 138 | //组织参数 |
139 | 139 | $strParam = $this->createStrParam(); |
140 | - $strParam .= 'sign=' . $sign; |
|
140 | + $strParam .= 'sign='.$sign; |
|
141 | 141 | //访问服务 |
142 | - $url = "{$this->url}?" . $strParam; |
|
142 | + $url = "{$this->url}?".$strParam; |
|
143 | 143 | $result = file_get_contents($url); |
144 | 144 | $result = json_decode($result, true); |
145 | 145 | $this->output = $result; |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | { |
530 | 530 | if (is_object($object)) { |
531 | 531 | $arr = (array)($object); |
532 | - } else { |
|
532 | + }else { |
|
533 | 533 | $arr = &$object; |
534 | 534 | } |
535 | 535 | if (is_array($arr)) { |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | ksort($this->param); |
558 | 558 | foreach ($this->param as $key => $val) { |
559 | 559 | if ($key != '' && $val != '') { |
560 | - $sign .= $key . $val; |
|
560 | + $sign .= $key.$val; |
|
561 | 561 | } |
562 | 562 | } |
563 | 563 | $sign .= $this->client_secret; |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | $strParam = ''; |
575 | 575 | foreach ($this->param as $key => $val) { |
576 | 576 | if ($key != '' && $val != '' && !is_array($val)) { |
577 | - $strParam .= $key . '=' . urlencode($val) . '&'; |
|
577 | + $strParam .= $key.'='.urlencode($val).'&'; |
|
578 | 578 | } |
579 | 579 | } |
580 | 580 | return $strParam; |