| 
...
 | 
...
 | 
@@ -720,6 +720,41 @@ public function search(Request $request) | 
| 
 | 
 | 
     }
 | 
| 
 | 
 | 
 
 | 
| 
 | 
 | 
     /**
 | 
| 
 | 
 | 
      * 生成robots.txt
 | 
| 
 | 
 | 
      * @param Request $request
 | 
| 
 | 
 | 
      */
 | 
| 
 | 
 | 
     public function updateRobots(Request $request){
 | 
| 
 | 
 | 
         $req["domain"] = $request->getHost();
 | 
| 
 | 
 | 
         //转发data
 | 
| 
 | 
 | 
         $transmitUrl = env("API_URL");
 | 
| 
 | 
 | 
         $resp = $this->httpPost($transmitUrl . "api/get_robots_content/", json_encode($req));
 | 
| 
 | 
 | 
         $robotsContent = $resp["data"]["content"];
 | 
| 
 | 
 | 
         $robotTxtPath = public_path($req["domain"]."/robots.txt");
 | 
| 
 | 
 | 
         $this->putSitemapFile($robotTxtPath,$robotsContent);
 | 
| 
 | 
 | 
         $this->response("success", self::SUCCESS, $resp["data"] ?? []);
 | 
| 
 | 
 | 
     }
 | 
| 
 | 
 | 
 
 | 
| 
 | 
 | 
     /**
 | 
| 
 | 
 | 
      * 放内容
 | 
| 
 | 
 | 
      * @param $sitemapPath
 | 
| 
 | 
 | 
      * @param $sitemapXmlDom
 | 
| 
 | 
 | 
      * @return false|int
 | 
| 
 | 
 | 
      */
 | 
| 
 | 
 | 
     public function putSitemapFile($sitemapPath, $sitemapXmlDom)
 | 
| 
 | 
 | 
     {
 | 
| 
 | 
 | 
         if (file_exists($sitemapPath)) {
 | 
| 
 | 
 | 
             $this->deleteDirectory($sitemapPath);
 | 
| 
 | 
 | 
         }
 | 
| 
 | 
 | 
         $res = file_put_contents($sitemapPath, $sitemapXmlDom);
 | 
| 
 | 
 | 
         try {
 | 
| 
 | 
 | 
             chmod($sitemapPath, 0777);
 | 
| 
 | 
 | 
         } catch (\Exception $e) {
 | 
| 
 | 
 | 
             return 1;
 | 
| 
 | 
 | 
         }
 | 
| 
 | 
 | 
         return $res;
 | 
| 
 | 
 | 
     }
 | 
| 
 | 
 | 
 
 | 
| 
 | 
 | 
     /**
 | 
| 
 | 
 | 
      * 输出处理日志
 | 
| 
 | 
 | 
      * @param $message
 | 
| 
 | 
 | 
      * @return bool
 | 
...
 | 
...
 | 
 |