优化打包类
This commit is contained in:
parent
a60880d327
commit
1d1eaa0338
@ -3,6 +3,7 @@ namespace catcher\library;
|
|||||||
|
|
||||||
use catcher\CatchAdmin;
|
use catcher\CatchAdmin;
|
||||||
use catcher\exceptions\FailedException;
|
use catcher\exceptions\FailedException;
|
||||||
|
use catcher\facade\Http;
|
||||||
use GuzzleHttp\Client;
|
use GuzzleHttp\Client;
|
||||||
use GuzzleHttp\TransferStats;
|
use GuzzleHttp\TransferStats;
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
@ -53,13 +54,19 @@ class Compress
|
|||||||
* download zip
|
* download zip
|
||||||
*
|
*
|
||||||
* @time 2020年04月30日
|
* @time 2020年04月30日
|
||||||
* @param $url
|
* @param $remotePackageUrl
|
||||||
* @param $moduleName
|
* @param $moduleName
|
||||||
* @return string
|
* @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();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user