Compare commits

...

3 Commits

Author SHA1 Message Date
山海紫穹
b83f93735c
Pre Merge pull request !45 from 山海紫穹/dev260107_2 2026-06-25 08:26:34 +00:00
lin
c73d6a1b27 处理全局异常 NoResourceFoundException 2026-06-25 16:26:22 +08:00
紫穹
8e32f17e6e fix: 添加80端口映射,否则无法播放推送的流 2026-01-07 07:51:54 +08:00
2 changed files with 13 additions and 1 deletions

View File

@ -59,7 +59,7 @@ services:
networks: networks:
- media-net - media-net
ports: ports:
#- "6080:80/tcp" # [播流]HTTP 安全考虑-非测试阶段需要注释掉改为由nginx代理播流地址 - "80:80/tcp" # [播流]HTTP 安全考虑-非测试阶段需要注释掉改为由nginx代理播流地址
#- "4443:443/tcp" # [播流]HTTPS 安全考虑-非测试阶段需要注释掉改为由nginx代理播流地址 #- "4443:443/tcp" # [播流]HTTPS 安全考虑-非测试阶段需要注释掉改为由nginx代理播流地址
- "${MediaRtmp:-10935}:${MediaRtmp:-10935}/tcp" # [收流]RTMP - "${MediaRtmp:-10935}:${MediaRtmp:-10935}/tcp" # [收流]RTMP
- "${MediaRtmp:-10935}:${MediaRtmp:-10935}/udp" # [收流]RTMP - "${MediaRtmp:-10935}:${MediaRtmp:-10935}/udp" # [收流]RTMP

View File

@ -11,6 +11,7 @@ import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.servlet.resource.NoResourceFoundException;
/** /**
* 全局异常处理 * 全局异常处理
@ -31,6 +32,17 @@ public class GlobalExceptionHandler {
return WVPResult.fail(ErrorCode.ERROR500.getCode(), e.getMessage()); return WVPResult.fail(ErrorCode.ERROR500.getCode(), e.getMessage());
} }
/**
* 默认异常处理
* @param e 异常
* @return 统一返回结果
*/
@ExceptionHandler(NoResourceFoundException.class)
@ResponseStatus(HttpStatus.BAD_REQUEST)
public WVPResult<String> exceptionHandler(NoResourceFoundException e) {
return WVPResult.fail(ErrorCode.ERROR404);
}
/** /**
* 默认异常处理 * 默认异常处理
* @param e 异常 * @param e 异常