|
@@ -119,7 +119,6 @@ class FileController |
|
@@ -119,7 +119,6 @@ class FileController |
|
119
|
if($file_hash !== false){
|
119
|
if($file_hash !== false){
|
|
120
|
return $this->response('资源',Code::SUCCESS,$this->responseData($file_hash['path'], $name));
|
120
|
return $this->response('资源',Code::SUCCESS,$this->responseData($file_hash['path'], $name));
|
|
121
|
}
|
121
|
}
|
|
122
|
- $url = $this->config['root'].$this->path;
|
|
|
|
123
|
$fileName = uniqid().rand(10000,99999).'.'.$files->getClientOriginalExtension();
|
122
|
$fileName = uniqid().rand(10000,99999).'.'.$files->getClientOriginalExtension();
|
|
124
|
//同步数据到cos
|
123
|
//同步数据到cos
|
|
125
|
if($this->upload_location == 0){
|
124
|
if($this->upload_location == 0){
|
|
@@ -130,12 +129,28 @@ class FileController |
|
@@ -130,12 +129,28 @@ class FileController |
|
130
|
$amazonS3Service = new AmazonS3Service();
|
129
|
$amazonS3Service = new AmazonS3Service();
|
|
131
|
$amazonS3Service->uploadFiles($files,$this->path,$fileName);
|
130
|
$amazonS3Service->uploadFiles($files,$this->path,$fileName);
|
|
132
|
}
|
131
|
}
|
|
|
|
132
|
+ $this->synchronizationFile($files->getClientOriginalExtension(),$fileName);
|
|
133
|
$this->saveMysql($fileModel,$files->getSize(),$files->getClientOriginalExtension(),$fileName,$hash,$this->upload_location,$files->getMimeType(),$name);
|
133
|
$this->saveMysql($fileModel,$files->getSize(),$files->getClientOriginalExtension(),$fileName,$hash,$this->upload_location,$files->getMimeType(),$name);
|
|
134
|
$this->response('资源',Code::SUCCESS,$this->responseData($this->path.'/'.$fileName, $name));
|
134
|
$this->response('资源',Code::SUCCESS,$this->responseData($this->path.'/'.$fileName, $name));
|
|
135
|
}
|
135
|
}
|
|
136
|
|
136
|
|
|
137
|
- //curl -X POST -F "file=@/path/to/your/file.jpg" -F "save_link=/path/to/save/directory" https://www.example.com/upload.php
|
|
|
|
138
|
-
|
137
|
+ /**
|
|
|
|
138
|
+ * @remark :指定同步文件到獨立177服務器
|
|
|
|
139
|
+ * @name :synchronizationFile
|
|
|
|
140
|
+ * @author :lyh
|
|
|
|
141
|
+ * @method :post
|
|
|
|
142
|
+ * @time :2024/4/8 11:10
|
|
|
|
143
|
+ */
|
|
|
|
144
|
+ public function synchronizationFile($file_type,$fileName){
|
|
|
|
145
|
+ $fileTypeArr = ['zip', 'pdf', 'mp4', 'doc', 'docx', 'm4v', 'xlsx'];
|
|
|
|
146
|
+ if(in_array($file_type,$fileTypeArr)){
|
|
|
|
147
|
+ //同步到大文件
|
|
|
|
148
|
+ $file_path = getFileUrl($this->path.'/'.$fileName,$this->cache['storage_type'] ?? 0);
|
|
|
|
149
|
+ $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->path.'" https://v6-file.globalso.com/upload.php';
|
|
|
|
150
|
+ shell_exec($cmd);
|
|
|
|
151
|
+ }
|
|
|
|
152
|
+ return true;
|
|
|
|
153
|
+ }
|
|
139
|
|
154
|
|
|
140
|
/**
|
155
|
/**
|
|
141
|
* 接口上传单文件
|
156
|
* 接口上传单文件
|