quote.go 986 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. package quote
  2. import (
  3. "mtp20access/model/common/response"
  4. "mtp20access/model/quote/request"
  5. "mtp20access/service/quote"
  6. "github.com/gin-gonic/gin"
  7. )
  8. func Quote(c *gin.Context) {
  9. if err := quote.QuoteConn(c); err != nil {
  10. response.FailWithMessage(err.Error(), c)
  11. // return
  12. }
  13. // response.OkWithMessage("连接成功", c)
  14. }
  15. // SendMsgToMQ 订阅商品实时行情请求
  16. // @Summary 实时行情
  17. // @Security ApiKeyAuth
  18. // @accept application/json
  19. // @Produce application/json
  20. // @Param data body []request.QuoteSubscribeReq true "入参"
  21. // @Success 200 {object} response.Response{msg=string} "出参"
  22. // @Router /Quote/QuoteSubscribe [post]
  23. // @Tags 实时行情
  24. func QuoteSubscribe(c *gin.Context) {
  25. var req []request.QuoteSubscribeReq
  26. if err := c.ShouldBindJSON(&req); err != nil {
  27. response.FailWithMessage("入参不正确", c)
  28. return
  29. }
  30. if err := quote.QuoteSubscribe(c, req); err != nil {
  31. response.FailWithMessage(err.Error(), c)
  32. }
  33. }