作者 lyh

gx

@@ -35,6 +35,9 @@ class FileController @@ -35,6 +35,9 @@ class FileController
35 $this->param = $this->request->all(); 35 $this->param = $this->request->all();
36 $this->config = config('filesystems.disks.upload'); 36 $this->config = config('filesystems.disks.upload');
37 $this->uploads = config('upload.default_file'); 37 $this->uploads = config('upload.default_file');
  38 + //获取当前登录用户详情
  39 + $this->token = $this->request->header('token');
  40 + $this->cache = Cache::get($this->token);
38 } 41 }
39 42
40 /** 43 /**
@@ -256,9 +259,6 @@ class FileController @@ -256,9 +259,6 @@ class FileController
256 if(isset($this->param['refer_type']) && $this->param['refer_type'] == 1){ 259 if(isset($this->param['refer_type']) && $this->param['refer_type'] == 1){
257 $this->path = $this->uploads['path_a'].'/'.$this->file_type[$this->param['refer']].'/'.date('Y-m'); 260 $this->path = $this->uploads['path_a'].'/'.$this->file_type[$this->param['refer']].'/'.date('Y-m');
258 }else{ 261 }else{
259 - //获取当前登录用户详情  
260 - $this->token = $this->request->header('token');  
261 - $this->cache = Cache::get($this->token);  
262 //B端上传,upload_method 为 1时 强制上传到本地 262 //B端上传,upload_method 为 1时 强制上传到本地
263 if(!isset($this->param['upload_method'])) { 263 if(!isset($this->param['upload_method'])) {
264 //根据项目上传标识区分上传到cos/本地 264 //根据项目上传标识区分上传到cos/本地
@@ -35,6 +35,7 @@ class ImageController extends Controller @@ -35,6 +35,7 @@ class ImageController extends Controller
35 public $map = []; 35 public $map = [];
36 36
37 37
  38 +
38 public $upload_location = 1;//是否同步到cos 39 public $upload_location = 1;//是否同步到cos
39 //上传图片类型 40 //上传图片类型
40 public $image_type = [ 41 public $image_type = [
@@ -53,6 +54,9 @@ class ImageController extends Controller @@ -53,6 +54,9 @@ class ImageController extends Controller
53 $this->config = config('filesystems.disks.upload'); 54 $this->config = config('filesystems.disks.upload');
54 $this->uploads = config('upload.default_image'); 55 $this->uploads = config('upload.default_image');
55 $this->get_param(); 56 $this->get_param();
  57 + //获取当前登录用户详情
  58 + $this->token = $this->request->header('token');
  59 + $this->cache = Cache::get($this->token);
56 } 60 }
57 61
58 /** 62 /**
@@ -345,6 +349,9 @@ class ImageController extends Controller @@ -345,6 +349,9 @@ class ImageController extends Controller
345 * @time :2023/6/29 11:48 349 * @time :2023/6/29 11:48
346 */ 350 */
347 public function getImageList(){ 351 public function getImageList(){
  352 + if(isset($this->cache['project_id']) && !empty($this->cache['project_id'])){
  353 + $this->map['project_id'] = $this->cache['project_id'];
  354 + }
348 $imageModel = new ImageModel(); 355 $imageModel = new ImageModel();
349 $lists = $imageModel->lists($this->map,$this->page,$this->row); 356 $lists = $imageModel->lists($this->map,$this->page,$this->row);
350 if(!empty($lists) && !empty($lists['list'])){ 357 if(!empty($lists) && !empty($lists['list'])){
@@ -368,9 +375,6 @@ class ImageController extends Controller @@ -368,9 +375,6 @@ class ImageController extends Controller
368 if(isset($this->param['refer_type']) && $this->param['refer_type'] == 1){ 375 if(isset($this->param['refer_type']) && $this->param['refer_type'] == 1){
369 $this->path = $this->uploads['path_a'].'/'.$this->image_type[$this->param['refer']].'/'.date('Y-m'); 376 $this->path = $this->uploads['path_a'].'/'.$this->image_type[$this->param['refer']].'/'.date('Y-m');
370 }else{ 377 }else{
371 - //B端上传  
372 - $this->token = $this->request->header('token');  
373 - $this->cache = Cache::get($this->token);  
374 if(!isset($this->param['upload_method'])){ 378 if(!isset($this->param['upload_method'])){
375 //根据项目上传标识区分上传到cos/本地 379 //根据项目上传标识区分上传到cos/本地
376 $projectModel = new Project(); 380 $projectModel = new Project();