| // +---------------------------------------------------------------------+ // | Repository | https://gitee.com/Bigotry/OneBase | // +---------------------------------------------------------------------+ namespace app\home\controller; use app\common\logic\File as LogicFile; use app\home\logic\HomeBase; /** * 文件控制器 */ class File extends HomeBase { /** * 图片上传 */ public function pictureUpload() { $result = $this->logicFile->pictureUpload(); return json($result); } /** * 文件上传 */ public function fileUpload() { $result = $this->logicFile->fileUpload(); return json($result); } /** * 编辑器图片上传 */ public function editorPictureUpload() { $result = get_sington_object('fileLogic', LogicFile::class)->pictureUpload('imgFile'); $data = false === $result ? [RESULT_ERROR => DATA_NORMAL, RESULT_MESSAGE => '文件上传失败'] : [RESULT_ERROR => DATA_DISABLE, RESULT_URL => get_picture_url($result['id'])]; return throw_response_exception($data); } }