正在显示
1 个修改的文件
包含
69 行增加
和
52 行删除
| @@ -5,6 +5,7 @@ | @@ -5,6 +5,7 @@ | ||
| 5 | * Date: 2023/09/02 | 5 | * Date: 2023/09/02 | 
| 6 | * Time: 10:36 | 6 | * Time: 10:36 | 
| 7 | */ | 7 | */ | 
| 8 | + | ||
| 8 | namespace App\Http\Controllers\Api; | 9 | namespace App\Http\Controllers\Api; | 
| 9 | 10 | ||
| 10 | use App\Http\Controllers\Controller; | 11 | use App\Http\Controllers\Controller; | 
| @@ -66,7 +67,7 @@ protected function error($message = 'error', $status = 400, $data = []) | @@ -66,7 +67,7 @@ protected function error($message = 'error', $status = 400, $data = []) | ||
| 66 | * @param string $type | 67 | * @param string $type | 
| 67 | * @return void | 68 | * @return void | 
| 68 | */ | 69 | */ | 
| 69 | - public function response($msg = null,$code = self::SUCCESS,$data = [],$result_code = 200,$type = 'application/json') | 70 | + public function response($msg = null, $code = self::SUCCESS, $data = [], $result_code = 200, $type = 'application/json') | 
| 70 | { | 71 | { | 
| 71 | $result = [ | 72 | $result = [ | 
| 72 | 'msg' => $msg, | 73 | 'msg' => $msg, | 
| @@ -74,7 +75,7 @@ public function response($msg = null,$code = self::SUCCESS,$data = [],$result_co | @@ -74,7 +75,7 @@ public function response($msg = null,$code = self::SUCCESS,$data = [],$result_co | ||
| 74 | 'data' => $data, | 75 | 'data' => $data, | 
| 75 | ]; | 76 | ]; | 
| 76 | $this->header['Content-Type'] = $type; | 77 | $this->header['Content-Type'] = $type; | 
| 77 | - $response = response($result,$result_code,$this->header); | 78 | + $response = response($result, $result_code, $this->header); | 
| 78 | throw new HttpResponseException($response); | 79 | throw new HttpResponseException($response); | 
| 79 | } | 80 | } | 
| 80 | 81 | ||
| @@ -83,7 +84,8 @@ public function response($msg = null,$code = self::SUCCESS,$data = [],$result_co | @@ -83,7 +84,8 @@ public function response($msg = null,$code = self::SUCCESS,$data = [],$result_co | ||
| 83 | * @param $url | 84 | * @param $url | 
| 84 | * @return mixed | 85 | * @return mixed | 
| 85 | */ | 86 | */ | 
| 86 | - public function curlGet($url){ | 87 | + public function curlGet($url) | 
| 88 | + { | ||
| 87 | $ch1 = curl_init(); | 89 | $ch1 = curl_init(); | 
| 88 | $timeout = 0; | 90 | $timeout = 0; | 
| 89 | curl_setopt($ch1, CURLOPT_URL, $url); | 91 | curl_setopt($ch1, CURLOPT_URL, $url); | 
| @@ -110,14 +112,14 @@ public function curlGet($url){ | @@ -110,14 +112,14 @@ public function curlGet($url){ | ||
| 110 | * @param bool $is_json | 112 | * @param bool $is_json | 
| 111 | * @return mixed|string | 113 | * @return mixed|string | 
| 112 | */ | 114 | */ | 
| 113 | - function httpPost($url, $data, $header = [],$is_json = true) | 115 | + function httpPost($url, $data, $header = [], $is_json = true) | 
| 114 | { | 116 | { | 
| 115 | if (empty($header)) { | 117 | if (empty($header)) { | 
| 116 | $header = array( | 118 | $header = array( | 
| 117 | "Accept: application/json", | 119 | "Accept: application/json", | 
| 118 | "Content-Type:application/json;charset=utf-8", | 120 | "Content-Type:application/json;charset=utf-8", | 
| 119 | - "token:".env("SECRET_TOKEN"), | ||
| 120 | - "pid:".env("MERCHANT_NUMBER") | 121 | + "token:" . env("SECRET_TOKEN"), | 
| 122 | + "pid:" . env("MERCHANT_NUMBER") | ||
| 121 | ); | 123 | ); | 
| 122 | } | 124 | } | 
| 123 | $ch = curl_init(); | 125 | $ch = curl_init(); | 
| @@ -137,7 +139,7 @@ function httpPost($url, $data, $header = [],$is_json = true) | @@ -137,7 +139,7 @@ function httpPost($url, $data, $header = [],$is_json = true) | ||
| 137 | @file_put_contents(storage_path('logs/error.log'), var_export($error_message, true) . PHP_EOL, FILE_APPEND); | 139 | @file_put_contents(storage_path('logs/error.log'), var_export($error_message, true) . PHP_EOL, FILE_APPEND); | 
| 138 | } | 140 | } | 
| 139 | curl_close($ch); | 141 | curl_close($ch); | 
| 140 | - if($is_json){ | 142 | + if ($is_json) { | 
| 141 | return json_decode($res, true); | 143 | return json_decode($res, true); | 
| 142 | } | 144 | } | 
| 143 | return trim($res); | 145 | return trim($res); | 
| @@ -156,7 +158,7 @@ public function uploadVerifyFile(Request $request) | @@ -156,7 +158,7 @@ public function uploadVerifyFile(Request $request) | ||
| 156 | $destinationPath = public_path($domain); | 158 | $destinationPath = public_path($domain); | 
| 157 | $file->move($destinationPath, $file->getClientOriginalName()); | 159 | $file->move($destinationPath, $file->getClientOriginalName()); | 
| 158 | $filePath = $destinationPath . '/' . $file->getClientOriginalName(); | 160 | $filePath = $destinationPath . '/' . $file->getClientOriginalName(); | 
| 159 | - @file_put_contents(storage_path('logs/upload_file.log'), date('Y-m-d H:i:s') . " ".$filePath . PHP_EOL, FILE_APPEND); | 161 | + @file_put_contents(storage_path('logs/upload_file.log'), date('Y-m-d H:i:s') . " " . $filePath . PHP_EOL, FILE_APPEND); | 
| 160 | } | 162 | } | 
| 161 | return $this->success(); | 163 | return $this->success(); | 
| 162 | } | 164 | } | 
| @@ -172,20 +174,20 @@ public function uploadAmpVerifyFile(Request $request) | @@ -172,20 +174,20 @@ public function uploadAmpVerifyFile(Request $request) | ||
| 172 | 174 | ||
| 173 | $domain_array = parse_url($domain); | 175 | $domain_array = parse_url($domain); | 
| 174 | $host = $domain_array['host'] ? $domain_array['path'] : ""; | 176 | $host = $domain_array['host'] ? $domain_array['path'] : ""; | 
| 175 | - $host_array = explode('.',$host); | ||
| 176 | - if(count($host_array) <= 2){ | ||
| 177 | - array_unshift($host_array,'m'); | ||
| 178 | - }else{ | 177 | + $host_array = explode('.', $host); | 
| 178 | + if (count($host_array) <= 2) { | ||
| 179 | + array_unshift($host_array, 'm'); | ||
| 180 | + } else { | ||
| 179 | $host_array[0] = 'm'; | 181 | $host_array[0] = 'm'; | 
| 180 | } | 182 | } | 
| 181 | - $amp_domain = implode('.',$host_array); | 183 | + $amp_domain = implode('.', $host_array); | 
| 182 | 184 | ||
| 183 | $files = $request->allFiles(); | 185 | $files = $request->allFiles(); | 
| 184 | foreach ($files as $file) { | 186 | foreach ($files as $file) { | 
| 185 | $destinationPath = public_path($amp_domain); | 187 | $destinationPath = public_path($amp_domain); | 
| 186 | $file->move($destinationPath, $file->getClientOriginalName()); | 188 | $file->move($destinationPath, $file->getClientOriginalName()); | 
| 187 | $filePath = $destinationPath . '/' . $file->getClientOriginalName(); | 189 | $filePath = $destinationPath . '/' . $file->getClientOriginalName(); | 
| 188 | - @file_put_contents(storage_path('logs/upload_file.log'), date('Y-m-d H:i:s') . " ".$filePath . PHP_EOL, FILE_APPEND); | 190 | + @file_put_contents(storage_path('logs/upload_file.log'), date('Y-m-d H:i:s') . " " . $filePath . PHP_EOL, FILE_APPEND); | 
| 189 | } | 191 | } | 
| 190 | return $this->success(); | 192 | return $this->success(); | 
| 191 | } | 193 | } | 
| @@ -196,25 +198,36 @@ public function uploadAmpVerifyFile(Request $request) | @@ -196,25 +198,36 @@ public function uploadAmpVerifyFile(Request $request) | ||
| 196 | * @param Request $request | 198 | * @param Request $request | 
| 197 | * @return string | 199 | * @return string | 
| 198 | */ | 200 | */ | 
| 199 | - public function websiteHtml(Request $request){ | 201 | + public function websiteHtml(Request $request) | 
| 202 | + { | ||
| 200 | $domain = $request->getHost(); | 203 | $domain = $request->getHost(); | 
| 204 | + $site_token = $request->input('site_token'); | ||
| 201 | $token = env("SECRET_TOKEN"); | 205 | $token = env("SECRET_TOKEN"); | 
| 202 | $pid = env("MERCHANT_NUMBER"); | 206 | $pid = env("MERCHANT_NUMBER"); | 
| 203 | $apiUrl = env("API_URL"); | 207 | $apiUrl = env("API_URL"); | 
| 204 | - $requestUrl = $apiUrl."api/get_url_verify_token/?pid=".$pid."&token=".$token."&domain=".$domain; | ||
| 205 | - @file_put_contents(storage_path('logs/notify_get_url.log'), date('Y-m-d H:i:s') . "接收到通知:". $requestUrl . PHP_EOL, FILE_APPEND); | 208 | + | 
| 209 | + if (empty($site_token)) { | ||
| 210 | + return $this->error('请求无效'); | ||
| 211 | + } | ||
| 212 | + | ||
| 213 | + if ($site_token != $token) { | ||
| 214 | + return $this->error('请求无效'); | ||
| 215 | + } | ||
| 216 | + | ||
| 217 | + $requestUrl = $apiUrl . "api/get_url_verify_token/?pid=" . $pid . "&token=" . $token . "&domain=" . $domain; | ||
| 218 | + @file_put_contents(storage_path('logs/notify_get_url.log'), date('Y-m-d H:i:s') . "接收到通知:" . $requestUrl . PHP_EOL, FILE_APPEND); | ||
| 206 | 219 | ||
| 207 | try { | 220 | try { | 
| 208 | $res = $this->curlGet($requestUrl); | 221 | $res = $this->curlGet($requestUrl); | 
| 209 | $url = isset($res["data"]["url"]) && !empty($res["data"]["url"]) ? urldecode($res["data"]["url"]) : ""; | 222 | $url = isset($res["data"]["url"]) && !empty($res["data"]["url"]) ? urldecode($res["data"]["url"]) : ""; | 
| 210 | - if ($res["status"] != self::SUCCESS || $url == ""){ | 223 | + if ($res["status"] != self::SUCCESS || $url == "") { | 
| 211 | $msg = isset($res["message"]) && !empty($res["message"]) ? $res["message"] : "请求失败!"; | 224 | $msg = isset($res["message"]) && !empty($res["message"]) ? $res["message"] : "请求失败!"; | 
| 212 | return $this->error($msg); | 225 | return $this->error($msg); | 
| 213 | } | 226 | } | 
| 214 | } catch (\Exception $e) { | 227 | } catch (\Exception $e) { | 
| 215 | return $this->error($e->getMessage()); | 228 | return $this->error($e->getMessage()); | 
| 216 | } | 229 | } | 
| 217 | - return $this->websiteHtmlHandle($url,$domain); | 230 | + return $this->websiteHtmlHandle($url, $domain); | 
| 218 | } | 231 | } | 
| 219 | 232 | ||
| 220 | /** | 233 | /** | 
| @@ -223,8 +236,8 @@ public function websiteHtml(Request $request){ | @@ -223,8 +236,8 @@ public function websiteHtml(Request $request){ | ||
| 223 | * @param $domain | 236 | * @param $domain | 
| 224 | * @return string | 237 | * @return string | 
| 225 | */ | 238 | */ | 
| 226 | -public function websiteHtmlHandle($url,$domain) | ||
| 227 | -{ | 239 | + public function websiteHtmlHandle($url, $domain) | 
| 240 | + { | ||
| 228 | $pathInfo = pathinfo($url); | 241 | $pathInfo = pathinfo($url); | 
| 229 | $extension = $pathInfo['extension']; | 242 | $extension = $pathInfo['extension']; | 
| 230 | //只允许解压zip格式文件 | 243 | //只允许解压zip格式文件 | 
| @@ -243,7 +256,7 @@ public function websiteHtmlHandle($url,$domain) | @@ -243,7 +256,7 @@ public function websiteHtmlHandle($url,$domain) | ||
| 243 | $this->deleteDirectory($targetFile); | 256 | $this->deleteDirectory($targetFile); | 
| 244 | 257 | ||
| 245 | $transmitUrl = env("TRANSMIT_URL"); | 258 | $transmitUrl = env("TRANSMIT_URL"); | 
| 246 | - $this->httpPost($transmitUrl."api/selfSiteNotify/",json_encode(['domain'=>$domain])); | 259 | + $this->httpPost($transmitUrl . "api/selfSiteNotify/", json_encode(['domain' => $domain])); | 
| 247 | } else { | 260 | } else { | 
| 248 | return $this->error('解压失败!'); | 261 | return $this->error('解压失败!'); | 
| 249 | // 处理打开压缩文件失败的情况 | 262 | // 处理打开压缩文件失败的情况 | 
| @@ -251,18 +264,19 @@ public function websiteHtmlHandle($url,$domain) | @@ -251,18 +264,19 @@ public function websiteHtmlHandle($url,$domain) | ||
| 251 | } catch (\Exception $e) { | 264 | } catch (\Exception $e) { | 
| 252 | return $this->error($e->getMessage()); | 265 | return $this->error($e->getMessage()); | 
| 253 | } | 266 | } | 
| 254 | - }else{ | 267 | + } else { | 
| 255 | return $this->error('不允许解压改格式压缩包!'); | 268 | return $this->error('不允许解压改格式压缩包!'); | 
| 256 | } | 269 | } | 
| 257 | return $this->success(); | 270 | return $this->success(); | 
| 258 | -} | 271 | + } | 
| 259 | 272 | ||
| 260 | /** | 273 | /** | 
| 261 | * 下载文件(下载到public目录下) | 274 | * 下载文件(下载到public目录下) | 
| 262 | * @param $url | 275 | * @param $url | 
| 263 | * @return string | 276 | * @return string | 
| 264 | */ | 277 | */ | 
| 265 | - public function downLoadFile($url){ | 278 | + public function downLoadFile($url) | 
| 279 | + { | ||
| 266 | $savePath = public_path(); | 280 | $savePath = public_path(); | 
| 267 | if (!file_exists($savePath)) { | 281 | if (!file_exists($savePath)) { | 
| 268 | mkdir($savePath, 0777, true); | 282 | mkdir($savePath, 0777, true); | 
| @@ -322,21 +336,22 @@ public function deleteDirectory($path) | @@ -322,21 +336,22 @@ public function deleteDirectory($path) | ||
| 322 | * @param int $traffic | 336 | * @param int $traffic | 
| 323 | * @return string | 337 | * @return string | 
| 324 | */ | 338 | */ | 
| 325 | - public function transmit($request, $type = self::TYPEVISIT, $traffic = self::TRAFFICZERO){ | ||
| 326 | - if($request->getClientIp() == "127.0.0.1"){ | 339 | + public function transmit($request, $type = self::TYPEVISIT, $traffic = self::TRAFFICZERO) | 
| 340 | + { | ||
| 341 | + if ($request->getClientIp() == "127.0.0.1") { | ||
| 327 | return $this->success(); | 342 | return $this->success(); | 
| 328 | } | 343 | } | 
| 329 | //判断是否是爬虫 | 344 | //判断是否是爬虫 | 
| 330 | $isReptile = $this->isReptile($request); | 345 | $isReptile = $this->isReptile($request); | 
| 331 | - if($isReptile){ | 346 | + if ($isReptile) { | 
| 332 | return $this->success(); | 347 | return $this->success(); | 
| 333 | } | 348 | } | 
| 334 | 349 | ||
| 335 | $data = $request->all(); | 350 | $data = $request->all(); | 
| 336 | - if (empty($data)){ | 351 | + if (empty($data)) { | 
| 337 | return $this->success(); | 352 | return $this->success(); | 
| 338 | } | 353 | } | 
| 339 | - $data["device_port"] = $this->userAgentHandle( $request->userAgent(),$data["device_port"] ?? self::DEVICE_PORT_ONE); | 354 | + $data["device_port"] = $this->userAgentHandle($request->userAgent(), $data["device_port"] ?? self::DEVICE_PORT_ONE); | 
| 340 | $req["data"] = $data; | 355 | $req["data"] = $data; | 
| 341 | $req["referer"] = $this->visitInfoHandle($data["referrer_url"] ?? $request->header('Referer')); | 356 | $req["referer"] = $this->visitInfoHandle($data["referrer_url"] ?? $request->header('Referer')); | 
| 342 | $req["domain"] = $request->getHost(); | 357 | $req["domain"] = $request->getHost(); | 
| @@ -349,13 +364,13 @@ public function transmit($request, $type = self::TYPEVISIT, $traffic = self::TRA | @@ -349,13 +364,13 @@ public function transmit($request, $type = self::TYPEVISIT, $traffic = self::TRA | ||
| 349 | 364 | ||
| 350 | //转发接口 | 365 | //转发接口 | 
| 351 | $transmitUrl = env("TRANSMIT_URL"); | 366 | $transmitUrl = env("TRANSMIT_URL"); | 
| 352 | - $resp = $this->httpPost($transmitUrl."api/selfSiteApi/",json_encode($req)); | ||
| 353 | - if ($resp["status"] != self::SUCCESS){ | 367 | + $resp = $this->httpPost($transmitUrl . "api/selfSiteApi/", json_encode($req)); | 
| 368 | + if ($resp["status"] != self::SUCCESS) { | ||
| 354 | $dataJson = json_encode($req); | 369 | $dataJson = json_encode($req); | 
| 355 | - if (!file_exists(storage_path('logs/fail_req'))){ | ||
| 356 | - mkdir(storage_path('logs/fail_req',0777,true)); | 370 | + if (!file_exists(storage_path('logs/fail_req'))) { | 
| 371 | + mkdir(storage_path('logs/fail_req', 0777, true)); | ||
| 357 | } | 372 | } | 
| 358 | - @file_put_contents(storage_path('logs/fail_req/'.date('Y-m-d').'.log'), var_export($dataJson, true) . PHP_EOL, FILE_APPEND); | 373 | + @file_put_contents(storage_path('logs/fail_req/' . date('Y-m-d') . '.log'), var_export($dataJson, true) . PHP_EOL, FILE_APPEND); | 
| 359 | } | 374 | } | 
| 360 | return $this->success(); | 375 | return $this->success(); | 
| 361 | } | 376 | } | 
| @@ -366,8 +381,9 @@ public function transmit($request, $type = self::TYPEVISIT, $traffic = self::TRA | @@ -366,8 +381,9 @@ public function transmit($request, $type = self::TYPEVISIT, $traffic = self::TRA | ||
| 366 | * @param $device_port | 381 | * @param $device_port | 
| 367 | * @return int | 382 | * @return int | 
| 368 | */ | 383 | */ | 
| 369 | - public function userAgentHandle($user_agent,$device_port){ | ||
| 370 | - if (!in_array($device_port,[self::DEVICE_PORT_ONE,self::DEVICE_PORT_TWO])){ | 384 | + public function userAgentHandle($user_agent, $device_port) | 
| 385 | + { | ||
| 386 | + if (!in_array($device_port, [self::DEVICE_PORT_ONE, self::DEVICE_PORT_TWO])) { | ||
| 371 | $device_port = self::DEVICE_PORT_ONE; | 387 | $device_port = self::DEVICE_PORT_ONE; | 
| 372 | } | 388 | } | 
| 373 | // 头信息中带有这些信息, 代表是手机端, 重置设备类型 | 389 | // 头信息中带有这些信息, 代表是手机端, 重置设备类型 | 
| @@ -394,11 +410,11 @@ public function customerVisit(Request $request) | @@ -394,11 +410,11 @@ public function customerVisit(Request $request) | ||
| 394 | */ | 410 | */ | 
| 395 | public function visitInfoHandle($referrerUrl) | 411 | public function visitInfoHandle($referrerUrl) | 
| 396 | { | 412 | { | 
| 397 | - if(preg_match('/google|facebook|bing|yahoo|youtobe|linkedin|messefrankfurt|yandex|tiktok|twitter|instagram|reddit|telegram|pinterest|tumblr/',$referrerUrl)){ | ||
| 398 | - }else if($referrerUrl == null){ | 413 | + if (preg_match('/google|facebook|bing|yahoo|youtobe|linkedin|messefrankfurt|yandex|tiktok|twitter|instagram|reddit|telegram|pinterest|tumblr/', $referrerUrl)) { | 
| 414 | + } else if ($referrerUrl == null) { | ||
| 399 | //直访用户 | 415 | //直访用户 | 
| 400 | $referrerUrl = ""; | 416 | $referrerUrl = ""; | 
| 401 | - }else{ | 417 | + } else { | 
| 402 | $referrerUrl = "https://www.google.com/"; | 418 | $referrerUrl = "https://www.google.com/"; | 
| 403 | } | 419 | } | 
| 404 | return $referrerUrl; | 420 | return $referrerUrl; | 
| @@ -413,7 +429,7 @@ public function isReptile($request) | @@ -413,7 +429,7 @@ public function isReptile($request) | ||
| 413 | { | 429 | { | 
| 414 | $agent = $request->header('User-Agent'); | 430 | $agent = $request->header('User-Agent'); | 
| 415 | if (!empty($agent)) { | 431 | if (!empty($agent)) { | 
| 416 | - $spiderSite= array( | 432 | + $spiderSite = array( | 
| 417 | "TencentTraveler", | 433 | "TencentTraveler", | 
| 418 | "Baiduspider+", | 434 | "Baiduspider+", | 
| 419 | "BaiduGame", | 435 | "BaiduGame", | 
| @@ -465,15 +481,15 @@ public function isReptile($request) | @@ -465,15 +481,15 @@ public function isReptile($request) | ||
| 465 | "bot" | 481 | "bot" | 
| 466 | ); | 482 | ); | 
| 467 | $flag = 0; | 483 | $flag = 0; | 
| 468 | - foreach($spiderSite as $val) { | 484 | + foreach ($spiderSite as $val) { | 
| 469 | $str = strtolower($val); | 485 | $str = strtolower($val); | 
| 470 | if (strpos($agent, $str) !== false) { | 486 | if (strpos($agent, $str) !== false) { | 
| 471 | $flag = 1; | 487 | $flag = 1; | 
| 472 | } | 488 | } | 
| 473 | } | 489 | } | 
| 474 | - if($flag == 1){ | 490 | + if ($flag == 1) { | 
| 475 | return true; | 491 | return true; | 
| 476 | - }else{ | 492 | + } else { | 
| 477 | return false; | 493 | return false; | 
| 478 | } | 494 | } | 
| 479 | } else { | 495 | } else { | 
| @@ -488,7 +504,7 @@ public function isReptile($request) | @@ -488,7 +504,7 @@ public function isReptile($request) | ||
| 488 | */ | 504 | */ | 
| 489 | public function trafficVisit(Request $request) | 505 | public function trafficVisit(Request $request) | 
| 490 | { | 506 | { | 
| 491 | - return $this->transmit($request,self::TYPEVISIT,self::TRAFFICONE); | 507 | + return $this->transmit($request, self::TYPEVISIT, self::TRAFFICONE); | 
| 492 | } | 508 | } | 
| 493 | 509 | ||
| 494 | /** | 510 | /** | 
| @@ -500,7 +516,7 @@ public function inquiry(Request $request) | @@ -500,7 +516,7 @@ public function inquiry(Request $request) | ||
| 500 | { | 516 | { | 
| 501 | $data = $request->all(); | 517 | $data = $request->all(); | 
| 502 | $black_ips = ['203.86.233.27', '37.19.221.202']; | 518 | $black_ips = ['203.86.233.27', '37.19.221.202']; | 
| 503 | - if(in_array(request()->getClientIp(), $black_ips)){ | 519 | + if (in_array(request()->getClientIp(), $black_ips)) { | 
| 504 | $this->success(); | 520 | $this->success(); | 
| 505 | } | 521 | } | 
| 506 | 522 | ||
| @@ -508,7 +524,7 @@ public function inquiry(Request $request) | @@ -508,7 +524,7 @@ public function inquiry(Request $request) | ||
| 508 | $ip = $request->ip(); | 524 | $ip = $request->ip(); | 
| 509 | $lock_key = 'lock_ip_' . $ip; | 525 | $lock_key = 'lock_ip_' . $ip; | 
| 510 | $rate_key = 'rate_limit:' . $ip; | 526 | $rate_key = 'rate_limit:' . $ip; | 
| 511 | - if(Cache::has($lock_key)){ | 527 | + if (Cache::has($lock_key)) { | 
| 512 | $this->success(); | 528 | $this->success(); | 
| 513 | } | 529 | } | 
| 514 | if (Cache::has($rate_key)) { | 530 | if (Cache::has($rate_key)) { | 
| @@ -523,7 +539,7 @@ public function inquiry(Request $request) | @@ -523,7 +539,7 @@ public function inquiry(Request $request) | ||
| 523 | } | 539 | } | 
| 524 | 540 | ||
| 525 | $data["files"] = $request->allFiles(); | 541 | $data["files"] = $request->allFiles(); | 
| 526 | - return $this->transmit($request,self::TYPEINQUIRY,self::TRAFFICZERO); | 542 | + return $this->transmit($request, self::TYPEINQUIRY, self::TRAFFICZERO); | 
| 527 | } | 543 | } | 
| 528 | 544 | ||
| 529 | /** | 545 | /** | 
| @@ -533,7 +549,7 @@ public function inquiry(Request $request) | @@ -533,7 +549,7 @@ public function inquiry(Request $request) | ||
| 533 | */ | 549 | */ | 
| 534 | public function inquiryOtherInfo(Request $request) | 550 | public function inquiryOtherInfo(Request $request) | 
| 535 | { | 551 | { | 
| 536 | - return $this->transmit($request,self::TYPEINQUIRY); | 552 | + return $this->transmit($request, self::TYPEINQUIRY); | 
| 537 | } | 553 | } | 
| 538 | 554 | ||
| 539 | /** | 555 | /** | 
| @@ -541,8 +557,9 @@ public function inquiryOtherInfo(Request $request) | @@ -541,8 +557,9 @@ public function inquiryOtherInfo(Request $request) | ||
| 541 | * @param Request $request | 557 | * @param Request $request | 
| 542 | * @return string | 558 | * @return string | 
| 543 | */ | 559 | */ | 
| 544 | - public function inquiryQd(Request $request){ | ||
| 545 | - return $this->transmit($request,self::TYPEINQUIRY); | 560 | + public function inquiryQd(Request $request) | 
| 561 | + { | ||
| 562 | + return $this->transmit($request, self::TYPEINQUIRY); | ||
| 546 | } | 563 | } | 
| 547 | 564 | ||
| 548 | /** | 565 | /** | 
| @@ -569,7 +586,7 @@ public function search(Request $request) | @@ -569,7 +586,7 @@ public function search(Request $request) | ||
| 569 | 586 | ||
| 570 | //转发data | 587 | //转发data | 
| 571 | $transmitUrl = env("API_URL"); | 588 | $transmitUrl = env("API_URL"); | 
| 572 | - $resp = $this->httpPost($transmitUrl."api/get_search_content/",json_encode($req)); | 589 | + $resp = $this->httpPost($transmitUrl . "api/get_search_content/", json_encode($req)); | 
| 573 | return $resp["data"]["html"]; | 590 | return $resp["data"]["html"]; | 
| 574 | } | 591 | } | 
| 575 | } | 592 | } | 
- 
请 注册 或 登录 后发表评论