正在显示
3 个修改的文件
包含
30 行增加
和
2 行删除
| @@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
| 3 | namespace App\Http\Controllers\File; | 3 | namespace App\Http\Controllers\File; |
| 4 | 4 | ||
| 5 | use App\Enums\Common\Code; | 5 | use App\Enums\Common\Code; |
| 6 | +use App\Models\File\ErrorFile; | ||
| 6 | use App\Models\File\File; | 7 | use App\Models\File\File; |
| 7 | use App\Models\Project\Project; | 8 | use App\Models\Project\Project; |
| 8 | use App\Services\AmazonS3Service; | 9 | use App\Services\AmazonS3Service; |
| @@ -145,7 +146,12 @@ class FileController | @@ -145,7 +146,12 @@ class FileController | ||
| 145 | //同步到大文件 | 146 | //同步到大文件 |
| 146 | $file_path = config('filesystems.disks.cos')['cdn1'].$this->path.'/'.$fileName; | 147 | $file_path = config('filesystems.disks.cos')['cdn1'].$this->path.'/'.$fileName; |
| 147 | $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->path.'" https://v6-file.globalso.com/upload.php'; | 148 | $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->path.'" https://v6-file.globalso.com/upload.php'; |
| 148 | - shell_exec($cmd); | 149 | + $code = shell_exec($cmd); |
| 150 | + if(200 != (int)$code){ | ||
| 151 | + $errorFileModel = new ErrorFile(); | ||
| 152 | + $errorFileModel->add(['path'=>$this->path.'/'.$fileName]); | ||
| 153 | + } | ||
| 154 | + return true; | ||
| 149 | } | 155 | } |
| 150 | 156 | ||
| 151 | /** | 157 | /** |
| @@ -5,6 +5,7 @@ namespace App\Http\Controllers\File; | @@ -5,6 +5,7 @@ namespace App\Http\Controllers\File; | ||
| 5 | use App\Enums\Common\Code; | 5 | use App\Enums\Common\Code; |
| 6 | use App\Http\Controllers\Controller; | 6 | use App\Http\Controllers\Controller; |
| 7 | use App\Http\Controllers\type; | 7 | use App\Http\Controllers\type; |
| 8 | +use App\Models\File\ErrorFile; | ||
| 8 | use App\Models\File\Image as ImageModel; | 9 | use App\Models\File\Image as ImageModel; |
| 9 | use App\Models\Project\Project; | 10 | use App\Models\Project\Project; |
| 10 | use App\Services\AmazonS3Service; | 11 | use App\Services\AmazonS3Service; |
| @@ -225,7 +226,11 @@ class ImageController extends Controller | @@ -225,7 +226,11 @@ class ImageController extends Controller | ||
| 225 | //同步到大文件 | 226 | //同步到大文件 |
| 226 | $file_path = getImageUrl($this->path.'/'.$fileName,$this->cache['storage_type'] ?? 0); | 227 | $file_path = getImageUrl($this->path.'/'.$fileName,$this->cache['storage_type'] ?? 0); |
| 227 | $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->path.'" https://v6-file.globalso.com/upload.php'; | 228 | $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->path.'" https://v6-file.globalso.com/upload.php'; |
| 228 | - shell_exec($cmd); | 229 | + $code = shell_exec($cmd); |
| 230 | + if(200 != (int)$code){ | ||
| 231 | + $errorFileModel = new ErrorFile(); | ||
| 232 | + $errorFileModel->add(['path'=>$this->path.'/'.$fileName]); | ||
| 233 | + } | ||
| 229 | } | 234 | } |
| 230 | 235 | ||
| 231 | /** | 236 | /** |
app/Models/File/ErrorFile.php
0 → 100644
-
请 注册 或 登录 后发表评论