|
@@ -42,8 +42,6 @@ class ImageController extends Controller |
|
@@ -42,8 +42,6 @@ class ImageController extends Controller |
|
42
|
public function __construct()
|
42
|
public function __construct()
|
|
43
|
{
|
43
|
{
|
|
44
|
$this->request = request();
|
44
|
$this->request = request();
|
|
45
|
- $this->token = $this->request->header('token');
|
|
|
|
46
|
- $this->cache = Cache::get($this->token);
|
|
|
|
47
|
$this->param = $this->request->all();
|
45
|
$this->param = $this->request->all();
|
|
48
|
$this->config = config('filesystems.disks.upload');
|
46
|
$this->config = config('filesystems.disks.upload');
|
|
49
|
$this->uploads = config('upload.default_image');
|
47
|
$this->uploads = config('upload.default_image');
|
|
@@ -323,14 +321,15 @@ class ImageController extends Controller |
|
@@ -323,14 +321,15 @@ class ImageController extends Controller |
|
323
|
$this->path = $this->uploads['path_a'].'/'.$this->image_type[$this->param['refer']].'/'.date('Y-m');
|
321
|
$this->path = $this->uploads['path_a'].'/'.$this->image_type[$this->param['refer']].'/'.date('Y-m');
|
|
324
|
}else{
|
322
|
}else{
|
|
325
|
//B端上传
|
323
|
//B端上传
|
|
326
|
- if(isset($this->param['upload_method']) && $this->param['upload_method'] == 1){
|
|
|
|
327
|
- //强制上传本地配置
|
|
|
|
328
|
- $this->upload_location = 0;
|
|
|
|
329
|
- }else{
|
324
|
+ $this->token = $this->request->header('token');
|
|
|
|
325
|
+ $this->cache = Cache::get($this->token);
|
|
|
|
326
|
+ if(!isset($this->param['upload_method'])){
|
|
330
|
//根据项目上传标识区分上传到cos/本地
|
327
|
//根据项目上传标识区分上传到cos/本地
|
|
331
|
$projectModel = new Project();
|
328
|
$projectModel = new Project();
|
|
332
|
$project_info = $projectModel->read(['id'=>$this->cache['project_id']],['upload_location']);
|
329
|
$project_info = $projectModel->read(['id'=>$this->cache['project_id']],['upload_location']);
|
|
333
|
- $this->upload_location = $project_info['upload_location'];
|
330
|
+ if ($project_info['upload_location'] == 0) {//不为普通项目时 上传到本地服务器
|
|
|
|
331
|
+ $this->upload_location = 1;//上传到cos
|
|
|
|
332
|
+ }
|
|
334
|
}
|
333
|
}
|
|
335
|
$this->path = $this->uploads['path_b'].'/'.$this->cache['project_id'].'/'.$this->image_type[$this->param['refer']].'/'.date('Y-m');
|
334
|
$this->path = $this->uploads['path_b'].'/'.$this->cache['project_id'].'/'.$this->image_type[$this->param['refer']].'/'.date('Y-m');
|
|
336
|
}
|
335
|
}
|