| 
@@ -215,6 +215,7 @@ public function websiteHtml(Request $request) | 
 | 
@@ -215,6 +215,7 @@ public function websiteHtml(Request $request) | 
| 
215
 | 
     {
 | 
215
 | 
     {
 | 
| 
216
 | 
         $domain = $request->getHost();
 | 
216
 | 
         $domain = $request->getHost();
 | 
| 
217
 | 
         $site_token = $request->input('site_token');
 | 
217
 | 
         $site_token = $request->input('site_token');
 | 
| 
 | 
   | 
218
 | 
+        $zip_count = $request->input('zip_count');
 | 
| 
218
 | 
         $token = env("SECRET_TOKEN");
 | 
219
 | 
         $token = env("SECRET_TOKEN");
 | 
| 
219
 | 
         $pid = env("MERCHANT_NUMBER");
 | 
220
 | 
         $pid = env("MERCHANT_NUMBER");
 | 
| 
220
 | 
         $apiUrl = env("API_URL");
 | 
221
 | 
         $apiUrl = env("API_URL");
 | 
 | 
@@ -232,8 +233,7 @@ public function websiteHtml(Request $request) | 
 | 
@@ -232,8 +233,7 @@ public function websiteHtml(Request $request) | 
| 
232
 | 
 
 | 
233
 | 
 
 | 
| 
233
 | 
         try {
 | 
234
 | 
         try {
 | 
| 
234
 | 
             $res = $this->curlGet($requestUrl);
 | 
235
 | 
             $res = $this->curlGet($requestUrl);
 | 
| 
235
 | 
-            $url = isset($res["data"]["url"]) && !empty($res["data"]["url"]) ? urldecode($res["data"]["url"]) : "";
 | 
 | 
   | 
| 
236
 | 
-            if ($res["status"] != self::SUCCESS || $url == "") {
 | 
236
 | 
+            if ($res["status"] != self::SUCCESS) {
 | 
| 
237
 | 
                 $msg = isset($res["message"]) && !empty($res["message"]) ? $res["message"] : "请求失败!";
 | 
237
 | 
                 $msg = isset($res["message"]) && !empty($res["message"]) ? $res["message"] : "请求失败!";
 | 
| 
238
 | 
                 return $this->error($msg);
 | 
238
 | 
                 return $this->error($msg);
 | 
| 
239
 | 
             }
 | 
239
 | 
             }
 | 
 | 
@@ -242,60 +242,48 @@ public function websiteHtml(Request $request) | 
 | 
@@ -242,60 +242,48 @@ public function websiteHtml(Request $request) | 
| 
242
 | 
         }
 | 
242
 | 
         }
 | 
| 
243
 | 
 
 | 
243
 | 
 
 | 
| 
244
 | 
         $info = [
 | 
244
 | 
         $info = [
 | 
| 
245
 | 
-            "url" => $url,
 | 
 | 
   | 
| 
246
 | 
             "domain" => $domain,
 | 
245
 | 
             "domain" => $domain,
 | 
| 
247
 | 
-            "num"=>0,
 | 
246
 | 
+            "zip_count" => $zip_count
 | 
| 
248
 | 
         ];
 | 
247
 | 
         ];
 | 
| 
249
 | 
         $info = json_encode($info);
 | 
248
 | 
         $info = json_encode($info);
 | 
| 
250
 | 
-        Redis::set('handle_html',$info);
 | 
249
 | 
+        Redis::set('handle_html', $info);
 | 
| 
251
 | 
         return $this->success();
 | 
250
 | 
         return $this->success();
 | 
| 
252
 | 
-        //return $this->websiteHtmlHandle($url, $domain);
 | 
 | 
   | 
| 
253
 | 
     }
 | 
251
 | 
     }
 | 
| 
254
 | 
 
 | 
252
 | 
 
 | 
| 
255
 | 
     /**
 | 
253
 | 
     /**
 | 
| 
256
 | 
      * 网站html解压
 | 
254
 | 
      * 网站html解压
 | 
| 
257
 | 
-     * @param $url
 | 
255
 | 
+     * @param $zip_count
 | 
| 
258
 | 
      * @param $domain
 | 
256
 | 
      * @param $domain
 | 
| 
259
 | 
-     * @return string
 | 
 | 
   | 
| 
260
 | 
      */
 | 
257
 | 
      */
 | 
| 
261
 | 
-    public function websiteHtmlHandle($url, $domain)
 | 
258
 | 
+    public function websiteHtmlHandle($zip_count, $domain)
 | 
| 
262
 | 
     {
 | 
259
 | 
     {
 | 
| 
263
 | 
-        $pathInfo = pathinfo($url);
 | 
 | 
   | 
| 
264
 | 
-        $extension = $pathInfo['extension'];
 | 
 | 
   | 
| 
265
 | 
-        //只允许解压zip格式文件
 | 
 | 
   | 
| 
266
 | 
-        if (in_array($extension, ["zip"])) {
 | 
 | 
   | 
| 
267
 | 
-            try {
 | 
 | 
   | 
| 
268
 | 
-                $targetFile = $this->downLoadFile($url);
 | 
 | 
   | 
| 
269
 | 
-                if ($targetFile == ""){
 | 
 | 
   | 
| 
270
 | 
-                    return false;
 | 
 | 
   | 
| 
271
 | 
-                }
 | 
 | 
   | 
| 
272
 | 
-                $zip = new ZipArchive();
 | 
 | 
   | 
| 
273
 | 
-                if ($zip->open($targetFile) === TRUE) {
 | 
 | 
   | 
| 
274
 | 
-                    $outputFolder = public_path($domain);
 | 
 | 
   | 
| 
275
 | 
-                    if (!is_dir($outputFolder)) {
 | 
 | 
   | 
| 
276
 | 
-                        mkdir($outputFolder, 0777, true);
 | 
 | 
   | 
| 
277
 | 
-                    }
 | 
 | 
   | 
| 
278
 | 
-                    // 解压缩文件,保留原文件结构
 | 
 | 
   | 
| 
279
 | 
-                    $zip->extractTo($outputFolder);
 | 
 | 
   | 
| 
280
 | 
-                    $zip->close();
 | 
 | 
   | 
| 
281
 | 
-                    $this->deleteDirectory($targetFile);
 | 
 | 
   | 
| 
282
 | 
-
 | 
 | 
   | 
| 
283
 | 
-                    $transmitUrl = env("TRANSMIT_URL");
 | 
 | 
   | 
| 
284
 | 
-                    $this->httpPost($transmitUrl . "api/selfSiteNotify/", json_encode(['domain' => $domain]));
 | 
 | 
   | 
| 
285
 | 
-                } else {
 | 
 | 
   | 
| 
286
 | 
-                    // 处理打开压缩文件失败的情况
 | 
 | 
   | 
| 
287
 | 
-                    $this->output("解压失败!");
 | 
 | 
   | 
| 
288
 | 
-                    return false;
 | 
260
 | 
+        $api_url = env('API_URL');
 | 
| 
 | 
   | 
261
 | 
+
 | 
| 
 | 
   | 
262
 | 
+        for ($i = 0; $i <= $zip_count; $i++) {
 | 
| 
 | 
   | 
263
 | 
+            $targetFile = $this->downLoadFile($api_url . $domain . '_part' . $i . '.zip');
 | 
| 
 | 
   | 
264
 | 
+            if ($targetFile == "") {
 | 
| 
 | 
   | 
265
 | 
+                $this->output('文件 ' . $targetFile . ' 不存在');
 | 
| 
 | 
   | 
266
 | 
+                continue;
 | 
| 
 | 
   | 
267
 | 
+            }
 | 
| 
 | 
   | 
268
 | 
+            $zip = new ZipArchive();
 | 
| 
 | 
   | 
269
 | 
+            if ($zip->open($targetFile) === TRUE) {
 | 
| 
 | 
   | 
270
 | 
+                $outputFolder = public_path($domain);
 | 
| 
 | 
   | 
271
 | 
+                if (!is_dir($outputFolder)) {
 | 
| 
 | 
   | 
272
 | 
+                    mkdir($outputFolder, 0777, true);
 | 
| 
289
 | 
                 }
 | 
273
 | 
                 }
 | 
| 
290
 | 
-            } catch (\Exception $e) {
 | 
 | 
   | 
| 
291
 | 
-                $this->output($this->error($e->getMessage()));
 | 
 | 
   | 
| 
292
 | 
-                return false;
 | 
274
 | 
+                // 解压缩文件,保留原文件结构
 | 
| 
 | 
   | 
275
 | 
+                $zip->extractTo($outputFolder);
 | 
| 
 | 
   | 
276
 | 
+                $zip->close();
 | 
| 
 | 
   | 
277
 | 
+                $this->deleteDirectory($targetFile);
 | 
| 
 | 
   | 
278
 | 
+            } else {
 | 
| 
 | 
   | 
279
 | 
+                // 处理打开压缩文件失败的情况
 | 
| 
 | 
   | 
280
 | 
+                $this->output('解压文件 ' . $targetFile . ' 失败');
 | 
| 
 | 
   | 
281
 | 
+                continue;
 | 
| 
293
 | 
             }
 | 
282
 | 
             }
 | 
| 
294
 | 
-        } else {
 | 
 | 
   | 
| 
295
 | 
-            $this->output("不允许解压改格式压缩包!");
 | 
 | 
   | 
| 
296
 | 
-            return false;
 | 
 | 
   | 
| 
297
 | 
         }
 | 
283
 | 
         }
 | 
| 
298
 | 
-        return true;
 | 
284
 | 
+
 | 
| 
 | 
   | 
285
 | 
+        $transmitUrl = env("TRANSMIT_URL");
 | 
| 
 | 
   | 
286
 | 
+        $this->httpPost($transmitUrl . "api/selfSiteNotify/", json_encode(['domain' => $domain]));
 | 
| 
299
 | 
     }
 | 
287
 | 
     }
 | 
| 
300
 | 
 
 | 
288
 | 
 
 | 
| 
301
 | 
     /**
 | 
289
 | 
     /**
 | 
 | 
@@ -310,7 +298,7 @@ public function downLoadFile($url) | 
 | 
@@ -310,7 +298,7 @@ public function downLoadFile($url) | 
| 
310
 | 
             mkdir($savePath, 0777, true);
 | 
298
 | 
             mkdir($savePath, 0777, true);
 | 
| 
311
 | 
         }
 | 
299
 | 
         }
 | 
| 
312
 | 
         $targetFile = $savePath . '/' . basename($url);
 | 
300
 | 
         $targetFile = $savePath . '/' . basename($url);
 | 
| 
313
 | 
-        if(!file_exists($targetFile)){
 | 
301
 | 
+        if (!file_exists($targetFile)) {
 | 
| 
314
 | 
             $file = fopen($targetFile, 'w');
 | 
302
 | 
             $file = fopen($targetFile, 'w');
 | 
| 
315
 | 
             fclose($file);
 | 
303
 | 
             fclose($file);
 | 
| 
316
 | 
             chmod($targetFile, 0755);
 | 
304
 | 
             chmod($targetFile, 0755);
 |