正在显示
1 个修改的文件
包含
12 行增加
和
2 行删除
@@ -340,7 +340,6 @@ public function deleteDirectory($path) | @@ -340,7 +340,6 @@ public function deleteDirectory($path) | ||
340 | * @return string | 340 | * @return string |
341 | */ | 341 | */ |
342 | public function transmit($request, $type = self::TYPEVISIT, $traffic = self::TRAFFICZERO){ | 342 | public function transmit($request, $type = self::TYPEVISIT, $traffic = self::TRAFFICZERO){ |
343 | - | ||
344 | if($request->getClientIp() == "127.0.0.1"){ | 343 | if($request->getClientIp() == "127.0.0.1"){ |
345 | return $this->success(); | 344 | return $this->success(); |
346 | } | 345 | } |
@@ -363,10 +362,21 @@ public function transmit($request, $type = self::TYPEVISIT, $traffic = self::TRA | @@ -363,10 +362,21 @@ public function transmit($request, $type = self::TYPEVISIT, $traffic = self::TRA | ||
363 | $req["files"] = isset($data["files"]) ? $data["files"] : null; | 362 | $req["files"] = isset($data["files"]) ? $data["files"] : null; |
364 | $req["type"] = $type; | 363 | $req["type"] = $type; |
365 | $req["traffic"] = $traffic; | 364 | $req["traffic"] = $traffic; |
365 | + $req["timestamp"] = time(); | ||
366 | 366 | ||
367 | //转发接口 | 367 | //转发接口 |
368 | $transmitUrl = env("TRANSMIT_URL"); | 368 | $transmitUrl = env("TRANSMIT_URL"); |
369 | - return $this->httpPost($transmitUrl."api/selfSiteApi/",json_encode($req)); | 369 | + $resp = $this->httpPost($transmitUrl."api/selfSiteApi/",json_encode($req)); |
370 | + if ($resp["code"] == self::SUCCESS){ | ||
371 | + return $resp; | ||
372 | + }else{ | ||
373 | + $dataJson = json_encode($req); | ||
374 | + if (!file_exists(storage_path('logs/fail_req'))){ | ||
375 | + mkdir(storage_path('logs/fail_req',0777,true)); | ||
376 | + } | ||
377 | + @file_put_contents(storage_path('logs/fail_req/'.date('Y-m-d').'.log'), var_export($dataJson, true) . PHP_EOL, FILE_APPEND); | ||
378 | + } | ||
379 | + return $this->success(); | ||
370 | } | 380 | } |
371 | 381 | ||
372 | /** | 382 | /** |
-
请 注册 或 登录 后发表评论