|
...
|
...
|
@@ -121,7 +121,7 @@ class FileController |
|
|
|
$url = $this->config['root'].$this->path;
|
|
|
|
$fileName = uniqid().rand(10000,99999).'.'.$files->getClientOriginalExtension();
|
|
|
|
//同步数据到cos
|
|
|
|
if($this->upload_location == 1){
|
|
|
|
if($this->upload_location == 0){
|
|
|
|
$cosService = new CosService();
|
|
|
|
$cosService->uploadFile($files,$this->path,$fileName);
|
|
|
|
}else{
|
|
...
|
...
|
@@ -234,7 +234,7 @@ class FileController |
|
|
|
$file_type = $file->getClientOriginalExtension();
|
|
|
|
$fileName = uniqid().rand(10000,99999).'.'.$file_type;
|
|
|
|
//同步数据到cos
|
|
|
|
if($this->upload_location == 1){
|
|
|
|
if($this->upload_location == 0){
|
|
|
|
$cosService = new CosService();
|
|
|
|
$cosService->uploadFile($files,$this->path,$fileName);
|
|
|
|
}else{
|
|
...
|
...
|
@@ -313,7 +313,7 @@ class FileController |
|
|
|
$projectModel = new Project();
|
|
|
|
$project_info = $projectModel->read(['id' => $this->cache['project_id']], ['project_location']);
|
|
|
|
if ($project_info['project_location'] != 0) {//通项目时 上传到cos
|
|
|
|
$this->upload_location = 0;//1:上传到本地
|
|
|
|
$this->upload_location = 1;//1:上传到本地
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$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 |
|
|
|
$fileModel = new File();
|
|
|
|
$lists = $fileModel->list($this->map,'id',['id','hash','type','path','created_at','name']);
|
|
|
|
foreach ($lists as $k => $v){
|
|
|
|
$v['file_link'] = getFileUrl($v['path'],$this->cache['project_location'] ?? 1,$this->cache['storage_type'] ?? 0);
|
|
|
|
$v['file_link'] = getFileUrl($v['path'],$this->cache['project_location'] ?? 0,$this->cache['storage_type'] ?? 0);
|
|
|
|
$lists[$k] = $v;
|
|
|
|
}
|
|
|
|
$this->response('success',Code::SUCCESS,$lists);
|
|
...
|
...
|
@@ -351,7 +351,7 @@ class FileController |
|
|
|
public function responseData($path, $name){
|
|
|
|
$data = [
|
|
|
|
'file'=>$path,
|
|
|
|
'file_link'=>getFileUrl($path,$this->cache['project_location'] ?? 1,$this->cache['storage_type'] ?? 0),
|
|
|
|
'file_link'=>getFileUrl($path,$this->cache['project_location'] ?? 0,$this->cache['storage_type'] ?? 0),
|
|
|
|
'name'=>$name,
|
|
|
|
'file_download'=>url('a/download_files?path='.$path)
|
|
|
|
];
|
...
|
...
|
|