|
@@ -17,12 +17,18 @@ class CronAction extends Action {
|
|
|
array_pop($files);
|
|
|
foreach ($files as $v) {
|
|
|
$path_parts = pathinfo($v);
|
|
|
- $start = time();
|
|
|
- $zip = $this->zip($path_parts['filename'], $path_parts['dirname']);
|
|
|
+ //$start = time();
|
|
|
+ //判断是否需要压缩,之前压缩过但没上传成功,需要重新上传
|
|
|
+ $zip_file = $path_parts['dirname'].'/' . $path_parts['filename'] . '.zip';
|
|
|
+ if(file_exists($zip_file)){
|
|
|
+ $zip = $zip_file;
|
|
|
+ }else{
|
|
|
+ $zip = $this->zip($path_parts['filename'], $path_parts['dirname']);
|
|
|
+ }
|
|
|
if ($zip) {//压缩完成
|
|
|
- echo '压缩用时:'.(time()-$start).PHP_EOL;
|
|
|
+ //echo '压缩用时:'.(time()-$start).PHP_EOL;
|
|
|
$tagetDat = $targetDir . '/' . $path_parts['filename'] . '.zip';
|
|
|
- echo $tagetDat . PHP_EOL;
|
|
|
+ //echo $tagetDat . PHP_EOL;
|
|
|
//删除本地dat文件
|
|
|
@unlink($path_parts['dirname'] . '/' . $path_parts['filename'] . '.dat');
|
|
|
$datRes = Zmcoding\FtpFile::getInstance($config)->up_file($zip, $tagetDat);
|