From 3b036d983e3ee871e0a897ba9ab47d897cd677bc Mon Sep 17 00:00:00 2001 From: stream Date: Tue, 26 Aug 2025 10:45:39 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=AF=AD=E9=9F=B3=E4=BA=A4=E4=BA=92?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/TekKeywordsSpotController.java | 28 +++++++++++++++++++ .../cmvr/common/core/domain/AjaxResult.java | 21 ++++++++++++++ .../cmvr/framework/config/SecurityConfig.java | 2 +- 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 cmvr-iot-admin/src/main/java/com/cmvr/web/controller/test/TekKeywordsSpotController.java diff --git a/cmvr-iot-admin/src/main/java/com/cmvr/web/controller/test/TekKeywordsSpotController.java b/cmvr-iot-admin/src/main/java/com/cmvr/web/controller/test/TekKeywordsSpotController.java new file mode 100644 index 0000000..b6e1548 --- /dev/null +++ b/cmvr-iot-admin/src/main/java/com/cmvr/web/controller/test/TekKeywordsSpotController.java @@ -0,0 +1,28 @@ +package com.cmvr.web.controller.test; + +import com.cmvr.common.core.domain.AjaxResult; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@Api(tags = "语音唤醒服务") +@RestController +@RequestMapping("/kws") +@RequiredArgsConstructor +public class TekKeywordsSpotController { + + @ApiOperation("唤醒") + @GetMapping("/wake") + public AjaxResult wake() { + return AjaxResult.ok("ok"); + } + + @ApiOperation("执行") + @GetMapping("/execute") + public AjaxResult execute() { + return AjaxResult.ok(); + } +} diff --git a/cmvr-iot-common/src/main/java/com/cmvr/common/core/domain/AjaxResult.java b/cmvr-iot-common/src/main/java/com/cmvr/common/core/domain/AjaxResult.java index 667d592..a97bc24 100644 --- a/cmvr-iot-common/src/main/java/com/cmvr/common/core/domain/AjaxResult.java +++ b/cmvr-iot-common/src/main/java/com/cmvr/common/core/domain/AjaxResult.java @@ -102,6 +102,27 @@ public class AjaxResult extends HashMap return new AjaxResult(HttpStatus.SUCCESS, msg, data); } + /** + * 返回成功消息 + * + * @param data 数据对象 + * @return 成功消息 + */ + public static AjaxResult ok(Object data) + { + return new AjaxResult(HttpStatus.SUCCESS, "操作成功", data); + } + + /** + * 返回成功消息 + * + * @return 成功消息 + */ + public static AjaxResult ok() + { + return new AjaxResult(HttpStatus.SUCCESS, "操作成功", null); + } + /** * 返回警告消息 * diff --git a/cmvr-iot-framework/src/main/java/com/cmvr/framework/config/SecurityConfig.java b/cmvr-iot-framework/src/main/java/com/cmvr/framework/config/SecurityConfig.java index 4f724cb..7f05ffe 100644 --- a/cmvr-iot-framework/src/main/java/com/cmvr/framework/config/SecurityConfig.java +++ b/cmvr-iot-framework/src/main/java/com/cmvr/framework/config/SecurityConfig.java @@ -114,7 +114,7 @@ public class SecurityConfig requests.antMatchers("/login", "/register", "/captchaImage").permitAll() // 静态资源,可匿名访问 .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() - .antMatchers("/ws/**","/api/grpc/**","/show/**","/node-red/**","/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() + .antMatchers("/kws/**","/ws/**","/api/grpc/**","/show/**","/node-red/**","/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() // 除上面外的所有请求全部需要鉴权认证 .anyRequest().authenticated(); })