uploadCoverImage(); $url = $storageService->getCiImageUrl($key); if ($url) { return $this->ajaxSuccess(['data' => ['src' => $url, 'title' => '']]); } else { return $this->ajaxError(['msg' => '上传文件失败']); } } /** * @Post("/content/img/upload", name="admin.content.img.upload") */ public function uploadContentImageAction() { $storageService = new StorageService(); $url = $storageService->uploadContentImage(); if ($url) { return $this->ajaxSuccess(['data' => ['src' => $url, 'title' => '']]); } else { return $this->ajaxError(['msg' => '上传文件失败']); } } }