|
|
@@ -4,6 +4,7 @@ package com.template.controller;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.template.common.utils.FileUtil;
|
|
|
import com.template.model.result.CommonResult;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
@@ -21,6 +22,9 @@ import java.nio.file.Files;
|
|
|
@RequestMapping("/auto/upload")
|
|
|
public class UploadServlet {
|
|
|
|
|
|
+ @Value("${image-url}")
|
|
|
+ private String imageUrl;
|
|
|
+
|
|
|
@PostMapping("/save")
|
|
|
protected CommonResult doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
|
// 获取文件内容
|
|
|
@@ -45,7 +49,7 @@ public class UploadServlet {
|
|
|
// out.write(buffer, 0, bytesRead);
|
|
|
// }
|
|
|
// out.close();
|
|
|
- String url="https://chtech.ncjti.edu.cn/hotel/image/"+fileNameWithPath;
|
|
|
+ String url=imageUrl+fileNameWithPath;
|
|
|
// response.getWriter().println(url);
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("url",url);
|