作者 lyh

gx

@@ -51,9 +51,6 @@ class ImageController extends Controller @@ -51,9 +51,6 @@ class ImageController extends Controller
51 $this->request = request(); 51 $this->request = request();
52 $this->token = $this->request->header('token'); 52 $this->token = $this->request->header('token');
53 $this->cache = Cache::get($this->token); 53 $this->cache = Cache::get($this->token);
54 - if(!isset($this->token) || empty($this->cache)){  
55 - return response(['code'=>Code::USER_LOGIN_ERROE,'msg'=>'当前用户未登录']);  
56 - }  
57 $this->param = $this->request->all(); 54 $this->param = $this->request->all();
58 $this->config = config('filesystems.disks.upload'); 55 $this->config = config('filesystems.disks.upload');
59 $this->uploads = config('upload.default_image'); 56 $this->uploads = config('upload.default_image');
@@ -161,7 +158,7 @@ class ImageController extends Controller @@ -161,7 +158,7 @@ class ImageController extends Controller
161 'size' => $res->getSize(), 158 'size' => $res->getSize(),
162 'hash' => $hash, 159 'hash' => $hash,
163 'type'=>$files->getClientOriginalExtension(), 160 'type'=>$files->getClientOriginalExtension(),
164 - 'refer'=>$this->param['refer'] ?? '', 161 + 'refer'=>$this->param['refer'] ?? 0,
165 ]; 162 ];
166 $rs = $imageModel->add($data); 163 $rs = $imageModel->add($data);
167 if ($rs === false) { 164 if ($rs === false) {
@@ -312,13 +309,13 @@ class ImageController extends Controller @@ -312,13 +309,13 @@ class ImageController extends Controller
312 * @time :2023/7/18 15:36 309 * @time :2023/7/18 15:36
313 */ 310 */
314 public function setUrl(){ 311 public function setUrl(){
315 - if(!isset($this->param['image_type'])){  
316 - $this->param['image_type'] = 1; 312 + if(!isset($this->param['refer'])){
  313 + $this->param['refer'] = 1;
317 } 314 }
318 if(isset($this->param['refer_type']) && $this->param['refer_type'] == 1){ 315 if(isset($this->param['refer_type']) && $this->param['refer_type'] == 1){
319 - $this->path = $this->uploads['path_a'].'/'.$this->image_type[$this->param['image_type']].'/'.date('Y-m'); 316 + $this->path = $this->uploads['path_a'].'/'.$this->image_type[$this->param['refer']].'/'.date('Y-m');
320 }else{ 317 }else{
321 - $this->path = $this->uploads['path_b'].'/'.$this->cache['project_id'].'/'.$this->image_type[$this->param['image_type']].'/'.date('Y-m'); 318 + $this->path = $this->uploads['path_b'].'/'.$this->cache['project_id'].'/'.$this->image_type[$this->param['refer']].'/'.date('Y-m');
322 } 319 }
323 } 320 }
324 } 321 }