|
|
|
|
@ -7,6 +7,7 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.http.MediaType;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
@ -30,6 +31,8 @@ import com.ruoyi.framework.config.ServerConfig;
|
|
|
|
|
public class CommonController
|
|
|
|
|
{
|
|
|
|
|
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
|
|
|
|
|
@Value("${ruoyi.serverUrl}")
|
|
|
|
|
private String serverUrl;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private ServerConfig serverConfig;
|
|
|
|
|
@ -80,7 +83,9 @@ public class CommonController
|
|
|
|
|
String filePath = RuoYiConfig.getUploadPath();
|
|
|
|
|
// 上传并返回新文件名称
|
|
|
|
|
String fileName = FileUploadUtils.upload(filePath, file);
|
|
|
|
|
String url = serverConfig.getUrl() + fileName;
|
|
|
|
|
// String url = serverConfig.getUrl() + fileName;
|
|
|
|
|
//由本机ip地址修改为外网映射地址
|
|
|
|
|
String url = serverUrl + fileName;
|
|
|
|
|
AjaxResult ajax = AjaxResult.success();
|
|
|
|
|
ajax.put("url", url);
|
|
|
|
|
ajax.put("fileName", fileName);
|
|
|
|
|
|