@@ -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 | } |
@@ -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); |
@@ -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 | |
@@ -60,14 +60,14 @@ discard block |
||
60 | 60 | if (!isset($array) || empty($array)) { |
61 | 61 | return $arrRet; |
62 | 62 | } |
63 | - $iCount = count($array) / $num; |
|
63 | + $iCount = count($array)/$num; |
|
64 | 64 | if (!is_int($iCount)) { |
65 | 65 | $iCount = ceil($iCount); |
66 | - } else { |
|
66 | + }else { |
|
67 | 67 | ++$iCount; |
68 | 68 | } |
69 | 69 | for ($i = 0; $i < $iCount; ++$i) { |
70 | - $arrInfos = array_slice($array, $i * $num, $num); |
|
70 | + $arrInfos = array_slice($array, $i*$num, $num); |
|
71 | 71 | if (empty($arrInfos)) { |
72 | 72 | continue; |
73 | 73 | } |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | foreach ($arrays as $array) { |
110 | 110 | if (is_array($array)) { |
111 | 111 | $key_arrays[] = $array[$sort_key]; |
112 | - } else { |
|
112 | + }else { |
|
113 | 113 | return []; |
114 | 114 | } |
115 | 115 | } |
116 | - } else { |
|
116 | + }else { |
|
117 | 117 | return []; |
118 | 118 | } |
119 | 119 | array_multisort($key_arrays, $sort_order, $sort_type, $arrays); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | foreach ($arr as $key => $value) { |
134 | 134 | if (is_array($value)) { |
135 | 135 | $arr[$key] = $this->TrimArray($value); |
136 | - } else { |
|
136 | + }else { |
|
137 | 137 | $arr[$key] = $this->trimAll($value); |
138 | 138 | } |
139 | 139 | } |
@@ -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 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | 'openwave', 'nexusone', 'cldc', 'midp', 'wap', 'mobile', 'alipay' |
130 | 130 | ]; |
131 | 131 | // 从HTTP_USER_AGENT中查找手机浏览器的关键字 |
132 | - if (preg_match("/(" . implode('|', $clientkeywords) . ")/i", strtolower(request()->server('HTTP_USER_AGENT')))) { |
|
132 | + if (preg_match("/(".implode('|', $clientkeywords).")/i", strtolower(request()->server('HTTP_USER_AGENT')))) { |
|
133 | 133 | return true; |
134 | 134 | } |
135 | 135 | } |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | $agent = strtolower(request()->server('HTTP_USER_AGENT')); |
202 | 202 | if (strpos($agent, 'iphone') || strpos($agent, 'ipad') || strpos($agent, 'android')) { |
203 | 203 | $type = 'mobile'; |
204 | - } else { |
|
204 | + }else { |
|
205 | 205 | $type = 'computer'; |
206 | 206 | } |
207 | 207 | return $type; |
@@ -231,6 +231,6 @@ discard block |
||
231 | 231 | public function getWebsiteAddress(): string |
232 | 232 | { |
233 | 233 | $http_type = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) ? 'https://' : 'http://'; |
234 | - return $http_type . $_SERVER['HTTP_HOST'] . "/"; |
|
234 | + return $http_type.$_SERVER['HTTP_HOST']."/"; |
|
235 | 235 | } |
236 | 236 | } |