mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-24 04:19:48 +01:00
Merge pull request #1345 from CaixyPromise/chore/server-manager
chore: 服务端管理接口代码健壮性调整,补充注释与删除署名注释。
This commit is contained in:
commit
a0822a356c
5 changed files with 8 additions and 19 deletions
|
|
@ -1,9 +1,6 @@
|
|||
package xiaozhi.modules.sys.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
|
@ -38,7 +35,7 @@ import xiaozhi.modules.sys.utils.WebSocketClientManager;
|
|||
* 服务端管理控制器
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("admin/server")
|
||||
@RequestMapping("/admin/server")
|
||||
@Tag(name = "服务端管理")
|
||||
@AllArgsConstructor
|
||||
public class ServerSideManageController {
|
||||
|
|
@ -46,6 +43,7 @@ public class ServerSideManageController {
|
|||
private static final ObjectMapper objectMapper;
|
||||
static {
|
||||
objectMapper = new ObjectMapper();
|
||||
// 忽略json字符串中存在,但pojo中不存在对应字段的情况
|
||||
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
}
|
||||
|
||||
|
|
@ -53,8 +51,11 @@ public class ServerSideManageController {
|
|||
@GetMapping("/server-list")
|
||||
@RequiresPermissions("sys:role:superAdmin")
|
||||
public Result<List<String>> getWsServerList() {
|
||||
String cachedWs = sysParamsService.getValue(Constant.SERVER_WEBSOCKET, true);
|
||||
return new Result<List<String>>().ok(Arrays.asList(cachedWs.split(";")));
|
||||
String wsText = sysParamsService.getValue(Constant.SERVER_WEBSOCKET, true);
|
||||
if (StringUtils.isBlank(wsText)) {
|
||||
return new Result<List<String>>().ok(Collections.emptyList());
|
||||
}
|
||||
return new Result<List<String>>().ok(Arrays.asList(wsText.split(";")));
|
||||
}
|
||||
|
||||
@Operation(summary = "通知python服务端更新配置")
|
||||
|
|
|
|||
|
|
@ -10,9 +10,6 @@ import xiaozhi.modules.sys.enums.ServerActionEnum;
|
|||
|
||||
/**
|
||||
* 发送python服务端操作DTO
|
||||
*
|
||||
* @Author CAIXYPROMISE
|
||||
* @since 2025/5/15 4:55
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
|
|
|
|||
|
|
@ -7,9 +7,6 @@ import java.util.Map;
|
|||
|
||||
/**
|
||||
* 服务端动作DTO
|
||||
*
|
||||
* @Author CAIXYPROMISE
|
||||
* @since 2025/5/15 5:10
|
||||
*/
|
||||
@Data
|
||||
public class ServerActionPayloadDTO
|
||||
|
|
|
|||
|
|
@ -6,9 +6,6 @@ import xiaozhi.common.exception.RenException;
|
|||
|
||||
/**
|
||||
* 服务端动作枚举
|
||||
*
|
||||
* @Author CAIXYPROMISE
|
||||
* @since 2025/5/15 4:57
|
||||
*/
|
||||
public enum ServerActionEnum
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,9 +7,6 @@ import org.apache.commons.lang3.StringUtils;
|
|||
|
||||
/**
|
||||
* 服务端调用响应枚举
|
||||
*
|
||||
* @Author CAIXYPROMISE
|
||||
* @since 2025/5/15 5:50
|
||||
*/
|
||||
public enum ServerActionResponseEnum
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue