mq.go 810 B

123456789101112131415161718192021222324252627282930
  1. package mq
  2. import (
  3. "mtp20access/model/common/response"
  4. "mtp20access/model/mq/request"
  5. "mtp20access/service/mq"
  6. "github.com/gin-gonic/gin"
  7. )
  8. // SendMsgToMQ 发送总线业务请求
  9. // @Summary 总线业务
  10. // @Security ApiKeyAuth
  11. // @accept application/json
  12. // @Produce application/json
  13. // @Param data body request.MQBodyReq true "入参"
  14. // @Success 200 {object} response.Response{data=response.MQBodyRsp,msg=string} "出参"
  15. // @Router /MQ/SendMsgToMQ [post]
  16. // @Tags 总线业务
  17. func SendMsgToMQ(c *gin.Context) {
  18. req := request.MQBodyReq{}
  19. if err := c.ShouldBindJSON(&req); err != nil {
  20. response.FailWithMessage("入参不正确", c)
  21. return
  22. }
  23. if err := mq.SendMQ(c, &req); err != nil {
  24. response.FailWithMessage(err.Error(), c)
  25. }
  26. }