@@ -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\facade; |
23 | 23 |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | if (empty($ip)) { |
40 | 40 | if (!isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
41 | 41 | $ip = $_SERVER['REMOTE_ADDR']; |
42 | - } else { |
|
42 | + }else { |
|
43 | 43 | //为了兼容百度的CDN,所以转成数组 |
44 | 44 | $arr = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); |
45 | 45 | $ip = $arr[0]; |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $myc->name($name) |
106 | 106 | ->expire($expire) |
107 | 107 | ->set($value); |
108 | - } else { |
|
108 | + }else { |
|
109 | 109 | $myc->name($name) |
110 | 110 | ->expire($expire) |
111 | 111 | ->update($value); |
@@ -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 | } |
@@ -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 | } |