|
...
|
...
|
@@ -162,7 +162,7 @@ class ImageController extends Controller |
|
|
|
$this->response('没有上传的文件!', Code::USER_ERROR);
|
|
|
|
}
|
|
|
|
$type = $this->request->post('type','single');
|
|
|
|
$this->setUrl();
|
|
|
|
$this->setUrl($files);
|
|
|
|
if ($type == 'multi') {
|
|
|
|
return $this->multi($files);
|
|
|
|
}else{
|
|
...
|
...
|
@@ -197,6 +197,7 @@ class ImageController extends Controller |
|
|
|
$image_type = $files->getClientOriginalExtension();
|
|
|
|
$fileName = uniqid().rand(10000,99999).'.'.$image_type;
|
|
|
|
//上传到cos
|
|
|
|
//TODO::设置上传文件大小
|
|
|
|
if($this->upload_location == 1){
|
|
|
|
$cosService = new CosService();
|
|
|
|
$cosService->uploadFile($files,$this->path,$fileName);
|
|
...
|
...
|
@@ -371,11 +372,24 @@ class ImageController extends Controller |
|
|
|
* @method :post
|
|
|
|
* @time :2023/7/18 15:36
|
|
|
|
*/
|
|
|
|
public function setUrl(){
|
|
|
|
public function setUrl($files){
|
|
|
|
//A端上传
|
|
|
|
if(isset($this->param['refer_type']) && $this->param['refer_type'] == 1){
|
|
|
|
$this->path = $this->uploads['path_a'].'/'.$this->image_type[$this->param['refer']].'/'.date('Y-m');
|
|
|
|
}else{
|
|
|
|
//TODO::设置上传文件大小(B端上传)
|
|
|
|
$max = config('upload.default_b_image')['size']['max'];
|
|
|
|
if(in_array($files)){
|
|
|
|
foreach ($files as $file){
|
|
|
|
if ($file->getSize() > $max) {
|
|
|
|
return $this->response('图片最大为500K',Code::SYSTEM_ERROR);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
if ($files->getSize() > $max) {
|
|
|
|
return $this->response('图片最大为500K',Code::SYSTEM_ERROR);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!isset($this->param['upload_method'])){
|
|
|
|
//根据项目上传标识区分上传到cos/本地
|
|
|
|
$projectModel = new Project();
|
...
|
...
|
|