ntf.go 925 B

123456789101112131415161718192021222324252627282930313233343536
  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. // SendNtfToMQ 发送总线通知信息
  11. // @Summary 总线通知
  12. // @accept application/json
  13. // @Produce application/json
  14. // @Param data body request.MQNtfReq true "入参"
  15. // @Success 200 {object} response.Response{msg=string} "出参"
  16. // @Router /MQ/SendNtfToMQ [post]
  17. // @Tags 总线业务
  18. func SendNtfToMQ(c *gin.Context) {
  19. req := request.MQNtfReq{}
  20. if err := c.ShouldBindJSON(&req); err != nil {
  21. response.FailWithMessage("入参不正确", c)
  22. return
  23. } else {
  24. global.M2A_LOG.Info("[C->S]", zap.Any("req", req.FunCode), zap.Any("data", req.Data))
  25. }
  26. if err := mq.SendNtfMQ(&req, 0); err != nil {
  27. response.FailWithMessage(err.Error(), c)
  28. return
  29. }
  30. response.OkWithMessage("发送成功", c)
  31. }