| 
@@ -720,6 +720,41 @@ public function search(Request $request) | 
 | 
@@ -720,6 +720,41 @@ public function search(Request $request) | 
| 
720
 | 
     }
 | 
720
 | 
     }
 | 
| 
721
 | 
 
 | 
721
 | 
 
 | 
| 
722
 | 
     /**
 | 
722
 | 
     /**
 | 
| 
 | 
   | 
723
 | 
+     * 生成robots.txt
 | 
| 
 | 
   | 
724
 | 
+     * @param Request $request
 | 
| 
 | 
   | 
725
 | 
+     */
 | 
| 
 | 
   | 
726
 | 
+    public function updateRobots(Request $request){
 | 
| 
 | 
   | 
727
 | 
+        $req["domain"] = $request->getHost();
 | 
| 
 | 
   | 
728
 | 
+        //转发data
 | 
| 
 | 
   | 
729
 | 
+        $transmitUrl = env("API_URL");
 | 
| 
 | 
   | 
730
 | 
+        $resp = $this->httpPost($transmitUrl . "api/get_robots_content/", json_encode($req));
 | 
| 
 | 
   | 
731
 | 
+        $robotsContent = $resp["data"]["content"];
 | 
| 
 | 
   | 
732
 | 
+        $robotTxtPath = public_path($req["domain"]."/robots.txt");
 | 
| 
 | 
   | 
733
 | 
+        $this->putSitemapFile($robotTxtPath,$robotsContent);
 | 
| 
 | 
   | 
734
 | 
+        $this->response("success", self::SUCCESS, $resp["data"] ?? []);
 | 
| 
 | 
   | 
735
 | 
+    }
 | 
| 
 | 
   | 
736
 | 
+
 | 
| 
 | 
   | 
737
 | 
+    /**
 | 
| 
 | 
   | 
738
 | 
+     * 放内容
 | 
| 
 | 
   | 
739
 | 
+     * @param $sitemapPath
 | 
| 
 | 
   | 
740
 | 
+     * @param $sitemapXmlDom
 | 
| 
 | 
   | 
741
 | 
+     * @return false|int
 | 
| 
 | 
   | 
742
 | 
+     */
 | 
| 
 | 
   | 
743
 | 
+    public function putSitemapFile($sitemapPath, $sitemapXmlDom)
 | 
| 
 | 
   | 
744
 | 
+    {
 | 
| 
 | 
   | 
745
 | 
+        if (file_exists($sitemapPath)) {
 | 
| 
 | 
   | 
746
 | 
+            $this->deleteDirectory($sitemapPath);
 | 
| 
 | 
   | 
747
 | 
+        }
 | 
| 
 | 
   | 
748
 | 
+        $res = file_put_contents($sitemapPath, $sitemapXmlDom);
 | 
| 
 | 
   | 
749
 | 
+        try {
 | 
| 
 | 
   | 
750
 | 
+            chmod($sitemapPath, 0777);
 | 
| 
 | 
   | 
751
 | 
+        } catch (\Exception $e) {
 | 
| 
 | 
   | 
752
 | 
+            return 1;
 | 
| 
 | 
   | 
753
 | 
+        }
 | 
| 
 | 
   | 
754
 | 
+        return $res;
 | 
| 
 | 
   | 
755
 | 
+    }
 | 
| 
 | 
   | 
756
 | 
+
 | 
| 
 | 
   | 
757
 | 
+    /**
 | 
| 
723
 | 
      * 输出处理日志
 | 
758
 | 
      * 输出处理日志
 | 
| 
724
 | 
      * @param $message
 | 
759
 | 
      * @param $message
 | 
| 
725
 | 
      * @return bool
 | 
760
 | 
      * @return bool
 |