作者 lyh

gx

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