作者 lyh

gx

@@ -106,6 +106,7 @@ class FileController @@ -106,6 +106,7 @@ class FileController
106 * @time :2023/6/17 16:32 106 * @time :2023/6/17 16:32
107 */ 107 */
108 public function single(&$files){ 108 public function single(&$files){
  109 + @file_put_contents(storage_path('logs/lyh_error.log'), var_export(111, true) . PHP_EOL, FILE_APPEND);
109 $hash = hash_file('md5', $files->getPathname()); 110 $hash = hash_file('md5', $files->getPathname());
110 $name = $files->getClientOriginalName(); 111 $name = $files->getClientOriginalName();
111 //查看文件是否存在 112 //查看文件是否存在
@@ -122,6 +123,7 @@ class FileController @@ -122,6 +123,7 @@ class FileController
122 $url = $this->config['root'].$this->path; 123 $url = $this->config['root'].$this->path;
123 $fileName = uniqid().rand(10000,99999).'.'.$files->getClientOriginalExtension(); 124 $fileName = uniqid().rand(10000,99999).'.'.$files->getClientOriginalExtension();
124 //同步数据到cos 125 //同步数据到cos
  126 + @file_put_contents(storage_path('logs/lyh_error.log'), var_export(222222, true) . PHP_EOL, FILE_APPEND);
125 if($this->upload_location == 1){ 127 if($this->upload_location == 1){
126 $cosService = new CosService(); 128 $cosService = new CosService();
127 $cosService->uploadFile($files,$this->path,$fileName); 129 $cosService->uploadFile($files,$this->path,$fileName);
@@ -131,6 +133,7 @@ class FileController @@ -131,6 +133,7 @@ class FileController
131 return $this->response($files->getError(), Code::USER_ERROR); 133 return $this->response($files->getError(), Code::USER_ERROR);
132 } 134 }
133 } 135 }
  136 + @file_put_contents(storage_path('logs/lyh_error.log'), var_export(333, true) . PHP_EOL, FILE_APPEND);
134 $this->saveMysql($fileModel,$files->getSize(),$files->getClientOriginalExtension(),$fileName,$hash,$this->upload_location,$files->getMimeType(),$name); 137 $this->saveMysql($fileModel,$files->getSize(),$files->getClientOriginalExtension(),$fileName,$hash,$this->upload_location,$files->getMimeType(),$name);
135 $this->response('资源',Code::SUCCESS,$this->responseData($this->path.'/'.$fileName, $name)); 138 $this->response('资源',Code::SUCCESS,$this->responseData($this->path.'/'.$fileName, $name));
136 } 139 }