feat: swag.
This commit is contained in:
@@ -29,6 +29,13 @@ func NewSystemDebugController() *SystemDebugController {
|
||||
return &SystemDebugController{}
|
||||
}
|
||||
|
||||
// @Summary 获取MQTT调试状态
|
||||
// @Description 获取MQTT调试服务的当前运行状态
|
||||
// @Tags 系统调试
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
// @Success 200 {object} SwagAPIResponse "查询成功"
|
||||
// @Router /admin/system-debug/mqtt/status [get]
|
||||
func (sc *SystemDebugController) MqttStatus(c *gin.Context) {
|
||||
service := mqtt.GetDebugService()
|
||||
if service == nil {
|
||||
@@ -38,6 +45,15 @@ func (sc *SystemDebugController) MqttStatus(c *gin.Context) {
|
||||
writeSuccess(c, http.StatusOK, "query success", service.Status())
|
||||
}
|
||||
|
||||
// @Summary 启动MQTT调试
|
||||
// @Description 启动MQTT调试服务
|
||||
// @Tags 系统调试
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param persist body mqttDebugStartRequest false "是否持久化到数据库"
|
||||
// @Security BearerAuth
|
||||
// @Success 200 {object} SwagAPIResponse "启动成功"
|
||||
// @Router /admin/system-debug/mqtt/start [post]
|
||||
func (sc *SystemDebugController) StartMqtt(c *gin.Context) {
|
||||
service := mqtt.GetDebugService()
|
||||
if service == nil {
|
||||
@@ -56,6 +72,13 @@ func (sc *SystemDebugController) StartMqtt(c *gin.Context) {
|
||||
writeSuccess(c, http.StatusOK, "start success", service.Status())
|
||||
}
|
||||
|
||||
// @Summary 停止MQTT调试
|
||||
// @Description 停止MQTT调试服务
|
||||
// @Tags 系统调试
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
// @Success 200 {object} SwagAPIResponse "停止成功"
|
||||
// @Router /admin/system-debug/mqtt/stop [post]
|
||||
func (sc *SystemDebugController) StopMqtt(c *gin.Context) {
|
||||
service := mqtt.GetDebugService()
|
||||
if service == nil {
|
||||
@@ -66,6 +89,12 @@ func (sc *SystemDebugController) StopMqtt(c *gin.Context) {
|
||||
writeSuccess(c, http.StatusOK, "stop success", service.Status())
|
||||
}
|
||||
|
||||
// @Summary MQTT WebSocket连接
|
||||
// @Description 通过WebSocket实时监听MQTT消息(需要SuperAdmin权限)
|
||||
// @Tags 系统调试
|
||||
// @Param token query string true "JWT Token"
|
||||
// @Success 101 "切换为WebSocket协议"
|
||||
// @Router /admin/system-debug/mqtt/ws [get]
|
||||
func (sc *SystemDebugController) MqttWebSocket(c *gin.Context) {
|
||||
service := mqtt.GetDebugService()
|
||||
if service == nil {
|
||||
|
||||
Reference in New Issue
Block a user