正在显示
3 个修改的文件
包含
14 行增加
和
14 行删除
| @@ -456,7 +456,7 @@ if (!function_exists('getImageUrl')) { | @@ -456,7 +456,7 @@ if (!function_exists('getImageUrl')) { | ||
| 456 | * @method :post | 456 | * @method :post |
| 457 | * @time :2023/7/20 16:46 | 457 | * @time :2023/7/20 16:46 |
| 458 | */ | 458 | */ |
| 459 | - function getImageUrl($path,$location = 1,$storage_type = 0){ | 459 | + function getImageUrl($path,$location = 0,$storage_type = 0){ |
| 460 | if(is_array($path)){ | 460 | if(is_array($path)){ |
| 461 | $url =[]; | 461 | $url =[]; |
| 462 | foreach ($path as $v){ | 462 | foreach ($path as $v){ |
| @@ -472,7 +472,7 @@ if (!function_exists('getImageUrl')) { | @@ -472,7 +472,7 @@ if (!function_exists('getImageUrl')) { | ||
| 472 | if(substr($path,0,2) == '//'){ | 472 | if(substr($path,0,2) == '//'){ |
| 473 | return 'https:'.$path; | 473 | return 'https:'.$path; |
| 474 | } | 474 | } |
| 475 | - if($location == 1){ | 475 | + if($location == 0){ |
| 476 | $cos = ($storage_type == 0) ? config('filesystems.disks.cos') : config('filesystems.disks.cos1'); | 476 | $cos = ($storage_type == 0) ? config('filesystems.disks.cos') : config('filesystems.disks.cos1'); |
| 477 | $cosCdn = $cos['cdn']; | 477 | $cosCdn = $cos['cdn']; |
| 478 | $url = $cosCdn.$path; | 478 | $url = $cosCdn.$path; |
| @@ -492,7 +492,7 @@ if (!function_exists('getFileUrl')) { | @@ -492,7 +492,7 @@ if (!function_exists('getFileUrl')) { | ||
| 492 | * @method :post | 492 | * @method :post |
| 493 | * @time :2023/7/20 16:46 | 493 | * @time :2023/7/20 16:46 |
| 494 | */ | 494 | */ |
| 495 | - function getFileUrl($path,$location = 1,$storage_type = 0){ | 495 | + function getFileUrl($path,$location = 0,$storage_type = 0){ |
| 496 | if(is_array($path)){ | 496 | if(is_array($path)){ |
| 497 | $url =[]; | 497 | $url =[]; |
| 498 | foreach ($path as $v){ | 498 | foreach ($path as $v){ |
| @@ -508,7 +508,7 @@ if (!function_exists('getFileUrl')) { | @@ -508,7 +508,7 @@ if (!function_exists('getFileUrl')) { | ||
| 508 | if(substr($path,0,2) == '//'){ | 508 | if(substr($path,0,2) == '//'){ |
| 509 | return 'https:'.$path; | 509 | return 'https:'.$path; |
| 510 | } | 510 | } |
| 511 | - if($location == 1){ | 511 | + if($location == 0){ |
| 512 | $cos = ($storage_type == 0) ? config('filesystems.disks.cos') : config('filesystems.disks.cos1'); | 512 | $cos = ($storage_type == 0) ? config('filesystems.disks.cos') : config('filesystems.disks.cos1'); |
| 513 | $cosCdn = $cos['cdn']; | 513 | $cosCdn = $cos['cdn']; |
| 514 | $url = $cosCdn.$path; | 514 | $url = $cosCdn.$path; |
| @@ -121,7 +121,7 @@ class FileController | @@ -121,7 +121,7 @@ class FileController | ||
| 121 | $url = $this->config['root'].$this->path; | 121 | $url = $this->config['root'].$this->path; |
| 122 | $fileName = uniqid().rand(10000,99999).'.'.$files->getClientOriginalExtension(); | 122 | $fileName = uniqid().rand(10000,99999).'.'.$files->getClientOriginalExtension(); |
| 123 | //同步数据到cos | 123 | //同步数据到cos |
| 124 | - if($this->upload_location == 1){ | 124 | + if($this->upload_location == 0){ |
| 125 | $cosService = new CosService(); | 125 | $cosService = new CosService(); |
| 126 | $cosService->uploadFile($files,$this->path,$fileName); | 126 | $cosService->uploadFile($files,$this->path,$fileName); |
| 127 | }else{ | 127 | }else{ |
| @@ -234,7 +234,7 @@ class FileController | @@ -234,7 +234,7 @@ class FileController | ||
| 234 | $file_type = $file->getClientOriginalExtension(); | 234 | $file_type = $file->getClientOriginalExtension(); |
| 235 | $fileName = uniqid().rand(10000,99999).'.'.$file_type; | 235 | $fileName = uniqid().rand(10000,99999).'.'.$file_type; |
| 236 | //同步数据到cos | 236 | //同步数据到cos |
| 237 | - if($this->upload_location == 1){ | 237 | + if($this->upload_location == 0){ |
| 238 | $cosService = new CosService(); | 238 | $cosService = new CosService(); |
| 239 | $cosService->uploadFile($files,$this->path,$fileName); | 239 | $cosService->uploadFile($files,$this->path,$fileName); |
| 240 | }else{ | 240 | }else{ |
| @@ -313,7 +313,7 @@ class FileController | @@ -313,7 +313,7 @@ class FileController | ||
| 313 | $projectModel = new Project(); | 313 | $projectModel = new Project(); |
| 314 | $project_info = $projectModel->read(['id' => $this->cache['project_id']], ['project_location']); | 314 | $project_info = $projectModel->read(['id' => $this->cache['project_id']], ['project_location']); |
| 315 | if ($project_info['project_location'] != 0) {//通项目时 上传到cos | 315 | if ($project_info['project_location'] != 0) {//通项目时 上传到cos |
| 316 | - $this->upload_location = 0;//1:上传到本地 | 316 | + $this->upload_location = 1;//1:上传到本地 |
| 317 | } | 317 | } |
| 318 | } | 318 | } |
| 319 | $this->path = $this->uploads['path_b'].'/'.$this->cache['project_id'].'/'.$this->file_type[$this->param['refer']].'/'.date('Y-m'); | 319 | $this->path = $this->uploads['path_b'].'/'.$this->cache['project_id'].'/'.$this->file_type[$this->param['refer']].'/'.date('Y-m'); |
| @@ -335,7 +335,7 @@ class FileController | @@ -335,7 +335,7 @@ class FileController | ||
| 335 | $fileModel = new File(); | 335 | $fileModel = new File(); |
| 336 | $lists = $fileModel->list($this->map,'id',['id','hash','type','path','created_at','name']); | 336 | $lists = $fileModel->list($this->map,'id',['id','hash','type','path','created_at','name']); |
| 337 | foreach ($lists as $k => $v){ | 337 | foreach ($lists as $k => $v){ |
| 338 | - $v['file_link'] = getFileUrl($v['path'],$this->cache['project_location'] ?? 1,$this->cache['storage_type'] ?? 0); | 338 | + $v['file_link'] = getFileUrl($v['path'],$this->cache['project_location'] ?? 0,$this->cache['storage_type'] ?? 0); |
| 339 | $lists[$k] = $v; | 339 | $lists[$k] = $v; |
| 340 | } | 340 | } |
| 341 | $this->response('success',Code::SUCCESS,$lists); | 341 | $this->response('success',Code::SUCCESS,$lists); |
| @@ -351,7 +351,7 @@ class FileController | @@ -351,7 +351,7 @@ class FileController | ||
| 351 | public function responseData($path, $name){ | 351 | public function responseData($path, $name){ |
| 352 | $data = [ | 352 | $data = [ |
| 353 | 'file'=>$path, | 353 | 'file'=>$path, |
| 354 | - 'file_link'=>getFileUrl($path,$this->cache['project_location'] ?? 1,$this->cache['storage_type'] ?? 0), | 354 | + 'file_link'=>getFileUrl($path,$this->cache['project_location'] ?? 0,$this->cache['storage_type'] ?? 0), |
| 355 | 'name'=>$name, | 355 | 'name'=>$name, |
| 356 | 'file_download'=>url('a/download_files?path='.$path) | 356 | 'file_download'=>url('a/download_files?path='.$path) |
| 357 | ]; | 357 | ]; |
| @@ -200,7 +200,7 @@ class ImageController extends Controller | @@ -200,7 +200,7 @@ class ImageController extends Controller | ||
| 200 | } | 200 | } |
| 201 | $fileName = uniqid().rand(10000,99999).'.'.$image_type; | 201 | $fileName = uniqid().rand(10000,99999).'.'.$image_type; |
| 202 | //上传到cos | 202 | //上传到cos |
| 203 | - if($this->upload_location == 1){ | 203 | + if($this->upload_location == 0){ |
| 204 | $cosService = new CosService(); | 204 | $cosService = new CosService(); |
| 205 | $cosService->uploadFile($files,$this->path,$fileName); | 205 | $cosService->uploadFile($files,$this->path,$fileName); |
| 206 | }else{ | 206 | }else{ |
| @@ -278,7 +278,7 @@ class ImageController extends Controller | @@ -278,7 +278,7 @@ class ImageController extends Controller | ||
| 278 | $image_type = $file->getClientOriginalExtension(); | 278 | $image_type = $file->getClientOriginalExtension(); |
| 279 | $fileName = uniqid().rand(10000,99999).'.'.$image_type; | 279 | $fileName = uniqid().rand(10000,99999).'.'.$image_type; |
| 280 | //同步数据到cos | 280 | //同步数据到cos |
| 281 | - if($this->upload_location == 1){ | 281 | + if($this->upload_location == 0){ |
| 282 | $cosService = new CosService(); | 282 | $cosService = new CosService(); |
| 283 | $cosService->uploadFile($file,$this->path,$fileName); | 283 | $cosService->uploadFile($file,$this->path,$fileName); |
| 284 | }else{ | 284 | }else{ |
| @@ -359,7 +359,7 @@ class ImageController extends Controller | @@ -359,7 +359,7 @@ class ImageController extends Controller | ||
| 359 | $lists = $imageModel->lists($this->map,$this->page,$this->row); | 359 | $lists = $imageModel->lists($this->map,$this->page,$this->row); |
| 360 | if(!empty($lists) && !empty($lists['list'])){ | 360 | if(!empty($lists) && !empty($lists['list'])){ |
| 361 | foreach ($lists['list'] as $k => $v){ | 361 | foreach ($lists['list'] as $k => $v){ |
| 362 | - $v['image_link'] = getImageUrl($v['path'],$this->cache['project_location'] ?? 1,$this->cache['storage_type'] ?? 0); | 362 | + $v['image_link'] = getImageUrl($v['path'],$this->cache['project_location'] ?? 0,$this->cache['storage_type'] ?? 0); |
| 363 | $lists['list'][$k] = $v; | 363 | $lists['list'][$k] = $v; |
| 364 | } | 364 | } |
| 365 | } | 365 | } |
| @@ -408,7 +408,7 @@ class ImageController extends Controller | @@ -408,7 +408,7 @@ class ImageController extends Controller | ||
| 408 | $projectModel = new Project(); | 408 | $projectModel = new Project(); |
| 409 | $project_info = $projectModel->read(['id'=>$this->cache['project_id']],['project_location']); | 409 | $project_info = $projectModel->read(['id'=>$this->cache['project_id']],['project_location']); |
| 410 | if ($project_info['project_location'] != 0) {//危险项目时 上传到本地 | 410 | if ($project_info['project_location'] != 0) {//危险项目时 上传到本地 |
| 411 | - $this->upload_location = 0;//上传到cos | 411 | + $this->upload_location = 1;//上传到本地 |
| 412 | } | 412 | } |
| 413 | } | 413 | } |
| 414 | $this->path = $this->uploads['path_b'].'/'.$this->cache['project_id'].'/'.$this->image_type[$this->param['refer']].'/'.date('Y-m'); | 414 | $this->path = $this->uploads['path_b'].'/'.$this->cache['project_id'].'/'.$this->image_type[$this->param['refer']].'/'.date('Y-m'); |
| @@ -425,7 +425,7 @@ class ImageController extends Controller | @@ -425,7 +425,7 @@ class ImageController extends Controller | ||
| 425 | public function responseData($path = '', $name = ''){ | 425 | public function responseData($path = '', $name = ''){ |
| 426 | $data = [ | 426 | $data = [ |
| 427 | 'image'=>$path, | 427 | 'image'=>$path, |
| 428 | - 'image_link'=>getImageUrl($path,$this->cache['project_location'] ?? 1,$this->cache['storage_type'] ?? 0), | 428 | + 'image_link'=>getImageUrl($path,$this->cache['project_location'] ?? 0,$this->cache['storage_type'] ?? 0), |
| 429 | 'name'=>$name, | 429 | 'name'=>$name, |
| 430 | 'image_download'=>url('a/download_images?path='.$path) | 430 | 'image_download'=>url('a/download_images?path='.$path) |
| 431 | ]; | 431 | ]; |
-
请 注册 或 登录 后发表评论