Procházet zdrojové kódy

20221014_门户接口增加

15143018065 před 2 roky
rodič
revize
872fd959fa

+ 4 - 5
ruoyi-modules/mz-portal/src/main/java/com/ruoyi/portal/controller/PortalSysDeptJlController.java

@@ -2,13 +2,13 @@ package com.ruoyi.portal.controller;
 
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.core.utils.StringUtils;
-import com.ruoyi.common.core.utils.file.FileTypeUtils;
 import com.ruoyi.common.core.web.controller.BaseController;
 import com.ruoyi.common.core.web.domain.AjaxResult;
 import com.ruoyi.common.core.web.page.TableDataInfo;
 import com.ruoyi.common.security.utils.SecurityUtils;
 import com.ruoyi.system.api.RemoteFileService;
-import com.ruoyi.system.api.domain.SysFile;import com.ruoyi.system.api.domain.SysObjDictType;
+import com.ruoyi.system.api.domain.SysFile;
+import com.ruoyi.system.api.domain.SysObjDictType;
 import com.ruoyi.system.db.DBExecResult;
 import com.ruoyi.system.db.DBFactory;
 import com.ruoyi.system.db.DBImpl;
@@ -102,15 +102,14 @@ public class PortalSysDeptJlController extends BaseController
     public AjaxResult uploadFile(MultipartFile file)
     {
         if (!file.isEmpty()) {
-            String extension = FileTypeUtils.getExtension(file);
             R<SysFile> fileResult = remoteFileService.upload(file);
             if (StringUtils.isNull(fileResult) || StringUtils.isNull(fileResult.getData()))
             {
                 return AjaxResult.error("文件服务异常,请联系管理员");
             }
-            String url = fileResult.getData().getUrl();
             AjaxResult ajax = AjaxResult.success();
-            ajax.put("imgUrl", url);
+            ajax.put("url", fileResult.getData().getUrl());
+            ajax.put("name", fileResult.getData().getName());
             return ajax;
         }
         return AjaxResult.error("上传图片异常,请联系管理员");