diff --git a/netty-client/src/main/resources/venue.conf b/netty-client/src/main/resources/venue.conf index 437ecc5..5330f71 100644 --- a/netty-client/src/main/resources/venue.conf +++ b/netty-client/src/main/resources/venue.conf @@ -1 +1,5 @@ -{"serverIp":"127.0.0.1","serverPort":"56791","clientSN":"MC-5824T23014127","clientVid":"41"} \ No newline at end of file +{"serverIp":"127.0.0.1","serverPort":"56791","clientSN":"MC-5824T23014127","clientVid":"41"} +-- 如果要改篮球馆的id +update sv_venue set `id` = 60 where `id` = 1; +update sv_venue_image set venue_id = 60 where venue_id = 1; +update sv_venue_price set venue_id = 60 where venue_id = 1; \ No newline at end of file diff --git a/oms/src/main/java/com/sv/oms/controller/UploadController.java b/oms/src/main/java/com/sv/oms/controller/UploadController.java index 39bec21..488544c 100644 --- a/oms/src/main/java/com/sv/oms/controller/UploadController.java +++ b/oms/src/main/java/com/sv/oms/controller/UploadController.java @@ -1,17 +1,15 @@ package com.sv.oms.controller; +import com.sv.exception.oms.OmsException; import com.sv.service.common.OSSClientUtil; import com.ydd.framework.core.common.dto.ResponseDTO; import com.ydd.oms.controller.OmsController; -import org.apache.http.HttpRequest; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.multipart.MultipartHttpServletRequest; import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; import java.io.IOException; @RestController("upload") @@ -24,6 +22,11 @@ public class UploadController extends OmsController { @RequestMapping("/image") public ResponseDTO uploadImg(@RequestParam("file") MultipartFile file) throws IOException { + // 检查文件大小是否超过1MB + if (file.getSize() > 1 * 1024 * 1024) { + throw new OmsException("文件大小不能超过1MB"); + } + String imgUrl = ossClientUtil.uploadConfigImg(file); return ResponseDTO.ok().addAttribute("img",imgUrl); } @@ -56,6 +59,9 @@ public class UploadController extends OmsController { */ @RequestMapping(value = "/uploadFile") public ResponseDTO uploadFile(@RequestParam("file") MultipartFile multipartFile) throws IOException { + if (multipartFile.getSize() > 20 * 1024 * 1024) { + throw new OmsException("健康报告文件大小不能超过20MB"); + } String healthUrl = ossClientUtil.uploadHealth(multipartFile); return ResponseDTO.ok().addAttribute("docPath",healthUrl); }