From 1d1eaa033807382d8dcae7c234fb13af5abe48f1 Mon Sep 17 00:00:00 2001 From: JaguarJack Date: Fri, 22 May 2020 15:45:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=89=93=E5=8C=85=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/catcher/library/Compress.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/extend/catcher/library/Compress.php b/extend/catcher/library/Compress.php index 020a0a6..a2907fd 100644 --- a/extend/catcher/library/Compress.php +++ b/extend/catcher/library/Compress.php @@ -3,6 +3,7 @@ namespace catcher\library; use catcher\CatchAdmin; use catcher\exceptions\FailedException; +use catcher\facade\Http; use GuzzleHttp\Client; use GuzzleHttp\TransferStats; use Psr\Http\Message\ResponseInterface; @@ -53,13 +54,19 @@ class Compress * download zip * * @time 2020年04月30日 - * @param $url + * @param $remotePackageUrl * @param $moduleName * @return string */ - public function download($moduleName) + public function download($moduleName, $remotePackageUrl = '') { - return (new Http())->download('', CatchAdmin::directory() . $moduleName .'.zip'); + $response = Http::timeout(5) + ->options([ + 'save_to' => stream_for(fopen(CatchAdmin::directory() . $moduleName .'.zip', 'w+')) + ]) + ->get($remotePackageUrl); + + return $response->ok(); } /**