request->post(); if (empty($post['upload_type']) || !isset(Attachment::$uploadTypeExplain[$post['upload_type']])) { return $this->error('上传类型有误'); } $config = \Yii::$app->services->attachment->getStorageConfig($this->mall_id); $config['mall_id'] = $this->mall_id; $upload = new UploadHelper($config, $post['upload_type']); $upload->verifyFile(); $upload->save(); return $this->success('上传成功',$upload->getBaseInfo($this->mall_id,$this->user->mch_id ?? 0,0)); } catch (\Exception $e) { return $this->error('上传失败:'.$e->getMessage()); } } }