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