quote.go 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. // QuoteSubscribe 订阅商品实时行情请求
  16. // @Summary 订阅商品实时行情请求
  17. // @Security ApiKeyAuth
  18. // @accept application/json
  19. // @Produce application/json
  20. // @Param data body request.QuoteSubscribeReq true "入参1"
  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. return
  33. }
  34. response.OkWithMessage("订阅成功", c)
  35. }