@@ -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,7 +58,7 @@ discard block |
||
58 | 58 | date_default_timezone_set('Asia/Shanghai'); |
59 | 59 | $msec = 0; |
60 | 60 | list($msec, $sec) = explode(' ', microtime()); |
61 | - return (float)sprintf('%.0f', (floatval($msec) + floatval($sec)) * 1000); |
|
61 | + return (float)sprintf('%.0f', (floatval($msec)+floatval($sec))*1000); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | date_default_timezone_set('Asia/Shanghai'); |
73 | 73 | $end_time = strtotime($end_time); |
74 | 74 | $start_time = $start_time == '' ? time() : strtotime($start_time); |
75 | - return $end_time - $start_time; |
|
75 | + return $end_time-$start_time; |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | if (empty($time)) { |
112 | 112 | $time = time(); |
113 | 113 | } |
114 | - return date($format, $time - $mun); |
|
114 | + return date($format, $time-$mun); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | if (empty($time)) { |
128 | 128 | $time = time(); |
129 | 129 | } |
130 | - return date($format, $time + $mun); |
|
130 | + return date($format, $time+$mun); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | |
@@ -141,9 +141,9 @@ discard block |
||
141 | 141 | { |
142 | 142 | date_default_timezone_set('Asia/Shanghai'); |
143 | 143 | $date = date('H:i'); |
144 | - $curTime = strtotime($date);//当前时分 |
|
145 | - $assignTime1 = strtotime($start);//获得指定分钟时间戳,00:00 |
|
146 | - $assignTime2 = strtotime($end);//获得指定分钟时间戳,01:00 |
|
144 | + $curTime = strtotime($date); //当前时分 |
|
145 | + $assignTime1 = strtotime($start); //获得指定分钟时间戳,00:00 |
|
146 | + $assignTime2 = strtotime($end); //获得指定分钟时间戳,01:00 |
|
147 | 147 | $result = false; |
148 | 148 | if ($curTime > $assignTime1 && $curTime < $assignTime2) { |
149 | 149 | $result = true; |
@@ -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); |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | } |
152 | 152 | } |
153 | 153 | return false; |
154 | - } else { |
|
154 | + }else { |
|
155 | 155 | if ($str == $nee) { |
156 | 156 | return true; |
157 | 157 | } |
@@ -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 | |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | $xml = "<xml>"; |
45 | 45 | foreach ($values as $key => $val) { |
46 | 46 | if (is_array($val)) { |
47 | - $xml .= "<" . $key . ">" . $this->toXml($val) . "</" . $key . ">"; |
|
48 | - } else if (is_numeric($val)) { |
|
49 | - $xml .= "<" . $key . ">" . $val . "</" . $key . ">"; |
|
50 | - } else { |
|
51 | - $xml .= "<" . $key . "><![CDATA[" . $val . "]]></" . $key . ">"; |
|
47 | + $xml .= "<".$key.">".$this->toXml($val)."</".$key.">"; |
|
48 | + }else if (is_numeric($val)) { |
|
49 | + $xml .= "<".$key.">".$val."</".$key.">"; |
|
50 | + }else { |
|
51 | + $xml .= "<".$key."><![CDATA[".$val."]]></".$key.">"; |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | $xml .= "</xml>"; |
@@ -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 |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | public function read(string $sessionId): string |
58 | 58 | { |
59 | 59 | return (string)Db::table($this->table_name) |
60 | - ->where('session_id', $this->config['session_prefix'] . $sessionId) |
|
60 | + ->where('session_id', $this->config['session_prefix'].$sessionId) |
|
61 | 61 | ->whereTime('session_expire', '>=', time()) |
62 | 62 | ->order('session_expire desc') |
63 | 63 | ->value('session_data', ''); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | public function delete(string $sessionId): bool |
73 | 73 | { |
74 | 74 | $result = Db::table($this->table_name) |
75 | - ->where('session_id', $this->config['session_prefix'] . $sessionId) |
|
75 | + ->where('session_id', $this->config['session_prefix'].$sessionId) |
|
76 | 76 | ->delete(); |
77 | 77 | return $result ? true : false; |
78 | 78 | } |
@@ -89,20 +89,20 @@ discard block |
||
89 | 89 | public function write(string $sessionId, string $data): bool |
90 | 90 | { |
91 | 91 | $get = Db::table($this->table_name) |
92 | - ->where('session_id', $this->config['session_prefix'] . $sessionId) |
|
92 | + ->where('session_id', $this->config['session_prefix'].$sessionId) |
|
93 | 93 | ->whereTime('session_expire', '>=', time()) |
94 | 94 | ->field('id') |
95 | 95 | ->find(); |
96 | 96 | if (empty($get)) { |
97 | 97 | $params = [ |
98 | - 'session_id' => $this->config['session_prefix'] . $sessionId, |
|
98 | + 'session_id' => $this->config['session_prefix'].$sessionId, |
|
99 | 99 | 'session_expire' => Times::dateRear("Y-m-d H:i:s", $this->config['session_expire']), |
100 | 100 | 'session_data' => $data |
101 | 101 | ]; |
102 | 102 | $result = Db::table($this->table_name) |
103 | 103 | ->insert($params); |
104 | 104 | return $result ? true : false; |
105 | - } else { |
|
105 | + }else { |
|
106 | 106 | $params = [ |
107 | 107 | 'session_expire' => Times::dateRear("Y-m-d H:i:s", $this->config['session_expire']), |
108 | 108 | 'session_data' => $data |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | } |
187 | 187 | if (isset($this->aes_decrypt_data[$name])) { |
188 | 188 | return $this->aes_decrypt_data[$name]; |
189 | - } else { |
|
189 | + }else { |
|
190 | 190 | return $default; |
191 | 191 | } |
192 | 192 | } |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | $rear = strtotime('+2minute'); |
219 | 219 | if ($timestamp <= $rear && $timestamp >= $before) { |
220 | 220 | $this->aes_decrypt_data = $data; |
221 | - } else { |
|
221 | + }else { |
|
222 | 222 | $this->error('已超时,请重新尝试!'); |
223 | 223 | } |
224 | 224 | } |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | if (!empty(is_array($data))) { |
241 | 241 | $data = json_encode($data); |
242 | 242 | } |
243 | - return urlencode(base64_encode(openssl_encrypt($data, 'AES-128-CBC', $this->aes_md5, 1, $this->aes_md5_iv . $timestamp))); |
|
243 | + return urlencode(base64_encode(openssl_encrypt($data, 'AES-128-CBC', $this->aes_md5, 1, $this->aes_md5_iv.$timestamp))); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -257,6 +257,6 @@ discard block |
||
257 | 257 | if (empty($this->aes_md5_iv)) { |
258 | 258 | $this->setAesMd5Iv(); |
259 | 259 | } |
260 | - return openssl_decrypt(base64_decode(urldecode($data)), "AES-128-CBC", $this->aes_md5, true, $this->aes_md5_iv . $timestamp); |
|
260 | + return openssl_decrypt(base64_decode(urldecode($data)), "AES-128-CBC", $this->aes_md5, true, $this->aes_md5_iv.$timestamp); |
|
261 | 261 | } |
262 | 262 | } |
@@ -105,7 +105,7 @@ |
||
105 | 105 | 'domain' => request()->domain(), |
106 | 106 | 'url' => request()->url(), |
107 | 107 | 'node' => config('dtapp.exception.wechat.node', ''), |
108 | - 'info' => "ServerIp:" . $ip . ";CdnIp:" . $_SERVER['REMOTE_ADDR'] . ";ClientIp:" . get_ip(), |
|
108 | + 'info' => "ServerIp:".$ip.";CdnIp:".$_SERVER['REMOTE_ADDR'].";ClientIp:".get_ip(), |
|
109 | 109 | 'ip' => $ipinfo['location_all'], |
110 | 110 | 'error' => base64_encode($msg) |
111 | 111 | ]) |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | if (empty($ip)) { |
41 | 41 | if (!isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
42 | 42 | $ip = $_SERVER['REMOTE_ADDR']; |
43 | - } else { |
|
43 | + }else { |
|
44 | 44 | //为了兼容百度的CDN,所以转成数组 |
45 | 45 | $arr = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); |
46 | 46 | $ip = $arr[0]; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | //为了兼容百度的CDN,所以转成数组 |
62 | 62 | $arr = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); |
63 | 63 | return $arr[0]; |
64 | - } else { |
|
64 | + }else { |
|
65 | 65 | return $_SERVER['REMOTE_ADDR']; |
66 | 66 | } |
67 | 67 | } |
@@ -99,13 +99,13 @@ discard block |
||
99 | 99 | if (empty($value)) { |
100 | 100 | return $myc->name($name) |
101 | 101 | ->get(); |
102 | - } else { |
|
102 | + }else { |
|
103 | 103 | if (empty($myc->name($name) |
104 | 104 | ->get())) { |
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); |
@@ -50,7 +50,7 @@ |
||
50 | 50 | if (empty($this->ipPath)) { |
51 | 51 | throw new DtaException('请检查配置文件是否配置了IP数据库文件存放位置'); |
52 | 52 | } |
53 | - $this->reader = new IpIpReader($this->ipPath . 'ipipfree.ipdb'); |
|
53 | + $this->reader = new IpIpReader($this->ipPath.'ipipfree.ipdb'); |
|
54 | 54 | parent::__construct($app); |
55 | 55 | } |
56 | 56 |