作者 lyh

gx

... ... @@ -274,7 +274,7 @@ class FileController
$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) {
if(!isset($this->param['upload_method'])) {
//根据项目上传标识区分上传到cos/本地
$projectModel = new Project();
$project_info = $projectModel->read(['id' => $this->cache['project_id']], ['project_location']);
... ...
... ... @@ -42,8 +42,6 @@ class ImageController extends Controller
public function __construct()
{
$this->request = request();
$this->token = $this->request->header('token');
$this->cache = Cache::get($this->token);
$this->param = $this->request->all();
$this->config = config('filesystems.disks.upload');
$this->uploads = config('upload.default_image');
... ... @@ -323,14 +321,15 @@ class ImageController extends Controller
$this->path = $this->uploads['path_a'].'/'.$this->image_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);
if(!isset($this->param['upload_method'])){
//根据项目上传标识区分上传到cos/本地
$projectModel = new Project();
$project_info = $projectModel->read(['id'=>$this->cache['project_id']],['upload_location']);
$this->upload_location = $project_info['upload_location'];
if ($project_info['upload_location'] == 0) {//不为普通项目时 上传到本地服务器
$this->upload_location = 1;//上传到cos
}
}
$this->path = $this->uploads['path_b'].'/'.$this->cache['project_id'].'/'.$this->image_type[$this->param['refer']].'/'.date('Y-m');
}
... ...