作者 lyh

gx

@@ -165,7 +165,8 @@ class ImageController extends Controller @@ -165,7 +165,8 @@ class ImageController extends Controller
165 if ($rs === false) { 165 if ($rs === false) {
166 return $this->response('添加失败', Code::USER_ERROR); 166 return $this->response('添加失败', Code::USER_ERROR);
167 } 167 }
168 - return $this->uploadCos($this->path,$fileName,$data['type']); 168 + $cos = new TencentCosService();
  169 + return $cos->uploadToCos($files,$this->path,$fileName);
169 return $this->response('图片资源',Code::SUCCESS,['image'=>$hash]); 170 return $this->response('图片资源',Code::SUCCESS,['image'=>$hash]);
170 } 171 }
171 172
@@ -320,15 +321,4 @@ class ImageController extends Controller @@ -320,15 +321,4 @@ class ImageController extends Controller
320 } 321 }
321 } 322 }
322 323
323 - /**  
324 - * @remark :上传文件到cos  
325 - * @name :uploadCos  
326 - * @author :lyh  
327 - * @method :post  
328 - * @time :2023/7/18 17:38  
329 - */  
330 - public function uploadCos($path,$fileName,$image_type){  
331 - $txCos = new TencentCosService();  
332 - return $txCos->upload_image($path,$fileName,$image_type);  
333 - }  
334 } 324 }