作者 lyh

gx

@@ -35,7 +35,7 @@ class FileController @@ -35,7 +35,7 @@ class FileController
35 public $token = '';//token 35 public $token = '';//token
36 36
37 public $cache = '';//缓存数据 37 public $cache = '';//缓存数据
38 - public $upload_location = 1; 38 + public $upload_location = 0;
39 public $file_type = [ 39 public $file_type = [
40 2 => 'other',//其他 40 2 => 'other',//其他
41 1 => 'video',//视频 41 1 => 'video',//视频
@@ -47,8 +47,6 @@ class FileController @@ -47,8 +47,6 @@ class FileController
47 $this->param = $this->request->all(); 47 $this->param = $this->request->all();
48 $this->config = config('filesystems.disks.upload'); 48 $this->config = config('filesystems.disks.upload');
49 $this->uploads = config('upload.default_file'); 49 $this->uploads = config('upload.default_file');
50 - $this->token = $this->request->header('token');  
51 - $this->cache = Cache::get($this->token);  
52 } 50 }
53 51
54 /** 52 /**
@@ -272,15 +270,17 @@ class FileController @@ -272,15 +270,17 @@ class FileController
272 if(isset($this->param['refer_type']) && $this->param['refer_type'] == 1){ 270 if(isset($this->param['refer_type']) && $this->param['refer_type'] == 1){
273 $this->path = $this->uploads['path_a'].'/'.$this->file_type[$this->param['refer']].'/'.date('Y-m'); 271 $this->path = $this->uploads['path_a'].'/'.$this->file_type[$this->param['refer']].'/'.date('Y-m');
274 }else{ 272 }else{
275 - //B端上传  
276 - if(isset($this->param['upload_method']) && $this->param['upload_method'] == 1){  
277 - //强制上传本地配置  
278 - $this->upload_location = 0;  
279 - }else{ 273 + //获取当前登录用户详情
  274 + $this->token = $this->request->header('token');
  275 + $this->cache = Cache::get($this->token);
  276 + //B端上传,upload_method 为 1时 强制上传到本地
  277 + if(isset($this->param['upload_method']) && $this->param['upload_method'] != 1) {
280 //根据项目上传标识区分上传到cos/本地 278 //根据项目上传标识区分上传到cos/本地
281 $projectModel = new Project(); 279 $projectModel = new Project();
282 - $project_info = $projectModel->read(['id'=>$this->cache['project_id']],['project_location']);  
283 - $this->upload_location = $project_info['upload_location']; 280 + $project_info = $projectModel->read(['id' => $this->cache['project_id']], ['project_location']);
  281 + if ($project_info['upload_location'] == 0) {//不为普通项目时 上传到本地服务器
  282 + $this->upload_location = 1;//上传到cos
  283 + }
284 } 284 }
285 $this->path = $this->uploads['path_b'].'/'.$this->cache['project_id'].'/'.$this->file_type[$this->param['refer']].'/'.date('Y-m'); 285 $this->path = $this->uploads['path_b'].'/'.$this->cache['project_id'].'/'.$this->file_type[$this->param['refer']].'/'.date('Y-m');
286 } 286 }