package mq

import (
	"mtp20access/model/common/response"
	"mtp20access/model/mq/request"
	"mtp20access/service/mq"

	"github.com/gin-gonic/gin"
)

// SendMsgToMQ 发送总线业务请求
// @Summary  总线业务
// @Security ApiKeyAuth
// @accept   application/json
// @Produce  application/json
// @Param    data body     request.MQBodyReq                                     true "入参"
// @Success  200  {object} response.Response{data=response.MQBodyRsp,msg=string} "出参"
// @Router   /MQ/SendMsgToMQ [post]
// @Tags     总线业务
func SendMsgToMQ(c *gin.Context) {
	req := request.MQBodyReq{}
	if err := c.ShouldBindJSON(&req); err != nil {
		response.FailWithMessage("入参不正确", c)
		return
	}

	if err := mq.SendMQ(c, &req); err != nil {
		response.FailWithMessage(err.Error(), c)
	}
}
