feat(shengwang): 添加声网配置管理功能

- 新增 ShengWangConfigVO 数据传输对象
- 在 ShengWangController 中注入 appId 和 certificate 配置
- 添加 /getConfig 接口用于获取声网配置信息
- 使用 @RefreshScope 注解支持配置热更新
- 集成 Spring Cloud 配置中心注解支持
This commit is contained in:
曹鹏飞 2026-04-07 14:30:05 +08:00
parent 7a4c0d4655
commit 723828e69f
2 changed files with 37 additions and 1 deletions

View File

@ -1,10 +1,13 @@
package com.nflg.mobilebroken.admin.controller; package com.nflg.mobilebroken.admin.controller;
import com.nflg.mobilebroken.admin.pojo.query.ShengWangWebhookQuery; import com.nflg.mobilebroken.admin.pojo.query.ShengWangWebhookQuery;
import com.nflg.mobilebroken.admin.pojo.vo.ShengWangConfigVO;
import com.nflg.mobilebroken.admin.service.ShengWangService; import com.nflg.mobilebroken.admin.service.ShengWangService;
import com.nflg.mobilebroken.common.pojo.ApiResult; import com.nflg.mobilebroken.common.pojo.ApiResult;
import com.nflg.mobilebroken.common.pojo.dto.ShengWangChannelDTO; import com.nflg.mobilebroken.common.pojo.dto.ShengWangChannelDTO;
import com.nflg.mobilebroken.common.pojo.dto.ShengWangKickingRuleListItemDTO; import com.nflg.mobilebroken.common.pojo.dto.ShengWangKickingRuleListItemDTO;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -17,13 +20,19 @@ import java.util.Objects;
/** /**
* 声网音视频相关接口 * 声网音视频相关接口
*
* @author 曹鹏飞 * @author 曹鹏飞
*/ */
@RefreshScope
@RestController @RestController
@RequestMapping("/shengwang") @RequestMapping("/shengwang")
public class ShengWangController { public class ShengWangController {
@Value("${shengwang.rtc.appId}")
private String appId;
@Value("${shengwang.rtc.certificate}")
private String certificate;
@Resource @Resource
private ShengWangService shengWangService; private ShengWangService shengWangService;
@ -92,4 +101,12 @@ public class ShengWangController {
} }
return ApiResult.success(); return ApiResult.success();
} }
/**
* 获取声网配置
*/
@GetMapping("/getConfig")
public ApiResult<ShengWangConfigVO> getConfig() {
return ApiResult.success(ShengWangConfigVO.builder().appId(appId).certificate(certificate).build());
}
} }

View File

@ -0,0 +1,19 @@
package com.nflg.mobilebroken.admin.pojo.vo;
import lombok.Builder;
import lombok.Data;
@Data
@Builder
public class ShengWangConfigVO {
/**
* appId
*/
private String appId;
/**
* 证书
*/
private String certificate;
}