mq.go 952 B

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