zhou.xiaoning 2 years ago
parent
commit
c6c20a412c
5 changed files with 10 additions and 16 deletions
  1. 3 1
      api/v1/quote/quote.go
  2. 1 1
      client/client.go
  3. 2 5
      docs/docs.go
  4. 2 5
      docs/swagger.json
  5. 2 4
      docs/swagger.yaml

+ 3 - 1
api/v1/quote/quote.go

@@ -22,7 +22,7 @@ func Quote(c *gin.Context) {
 // @Security ApiKeyAuth
 // @Security ApiKeyAuth
 // @accept   application/json
 // @accept   application/json
 // @Produce  application/json
 // @Produce  application/json
-// @Param    data body     request.QuoteSubscribeReq   true "入参"
+// @Param    data body     request.QuoteSubscribeReq     true "入参1"
 // @Success  200  {object} response.Response{msg=string} "出参"
 // @Success  200  {object} response.Response{msg=string} "出参"
 // @Router   /Quote/QuoteSubscribe [post]
 // @Router   /Quote/QuoteSubscribe [post]
 // @Tags     实时行情
 // @Tags     实时行情
@@ -35,5 +35,7 @@ func QuoteSubscribe(c *gin.Context) {
 
 
 	if err := quote.QuoteSubscribe(c, req); err != nil {
 	if err := quote.QuoteSubscribe(c, req); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		response.FailWithMessage(err.Error(), c)
+		return
 	}
 	}
+	response.OkWithMessage("订阅成功", c)
 }
 }

+ 1 - 1
client/client.go

@@ -51,7 +51,7 @@ func (r *Client) SetQuoteSubs(req request.QuoteSubscribeReq) {
 	r.quoteSubs = req.QuoteGoodses
 	r.quoteSubs = req.QuoteGoodses
 
 
 	if r.ch != nil {
 	if r.ch != nil {
-		r.unSubscribe <- struct{}{}
+		// r.unSubscribe <- struct{}{}
 		global.M2A_Publish.Unsubscribe(publish.Topic_Quote, r.ch)
 		global.M2A_Publish.Unsubscribe(publish.Topic_Quote, r.ch)
 	}
 	}
 	r.ch = global.M2A_Publish.Subscribe(publish.Topic_Quote)
 	r.ch = global.M2A_Publish.Subscribe(publish.Topic_Quote)

+ 2 - 5
docs/docs.go

@@ -220,15 +220,12 @@ const docTemplate = `{
                 "summary": "实时行情",
                 "summary": "实时行情",
                 "parameters": [
                 "parameters": [
                     {
                     {
-                        "description": "入参",
+                        "description": "入参1",
                         "name": "data",
                         "name": "data",
                         "in": "body",
                         "in": "body",
                         "required": true,
                         "required": true,
                         "schema": {
                         "schema": {
-                            "type": "array",
-                            "items": {
-                                "$ref": "#/definitions/request.QuoteSubscribeReq"
-                            }
+                            "$ref": "#/definitions/request.QuoteSubscribeReq"
                         }
                         }
                     }
                     }
                 ],
                 ],

+ 2 - 5
docs/swagger.json

@@ -211,15 +211,12 @@
                 "summary": "实时行情",
                 "summary": "实时行情",
                 "parameters": [
                 "parameters": [
                     {
                     {
-                        "description": "入参",
+                        "description": "入参1",
                         "name": "data",
                         "name": "data",
                         "in": "body",
                         "in": "body",
                         "required": true,
                         "required": true,
                         "schema": {
                         "schema": {
-                            "type": "array",
-                            "items": {
-                                "$ref": "#/definitions/request.QuoteSubscribeReq"
-                            }
+                            "$ref": "#/definitions/request.QuoteSubscribeReq"
                         }
                         }
                     }
                     }
                 ],
                 ],

+ 2 - 4
docs/swagger.yaml

@@ -217,14 +217,12 @@ paths:
       consumes:
       consumes:
       - application/json
       - application/json
       parameters:
       parameters:
-      - description: 入参
+      - description: 入参1
         in: body
         in: body
         name: data
         name: data
         required: true
         required: true
         schema:
         schema:
-          items:
-            $ref: '#/definitions/request.QuoteSubscribeReq'
-          type: array
+          $ref: '#/definitions/request.QuoteSubscribeReq'
       produces:
       produces:
       - application/json
       - application/json
       responses:
       responses: