zhou.xiaoning hace 2 años
padre
commit
d4bd955646
Se han modificado 2 ficheros con 6 adiciones y 12 borrados
  1. 6 10
      client/wareInfo.go
  2. 0 2
      quote_publish/quote_publish.go

+ 6 - 10
client/wareInfo.go

@@ -7,8 +7,6 @@
 
 package client
 
-import "fmt"
-
 type wareInfo struct {
 	buf       []byte // 内容[报价开始(0x10):报价结束(0x11)]
 	exchId    string // 交易所id
@@ -20,16 +18,14 @@ type wareInfo struct {
 }
 
 func (r *wareInfo) getField(tag byte) string {
-	fmt.Printf("getField ----------------------- %v \n", tag)
-	fmt.Printf("r.buf(%v): %v \n", len(r.buf), r.buf)
-
 	for i, v := range r.buf {
 		if v == tag {
-			for j, d := range r.buf[i:] {
-				if d == 0x01 || d == 0x11 {
-					fmt.Printf("d:%v i:%v j:%v \n", d, i, j)
-					buf := r.buf[i+2 : i+j]
-					return string(buf)
+			if i > 0 && r.buf[i-1] == 0x01 {
+				for j, d := range r.buf[i:] {
+					if d == 0x01 || d == 0x11 {
+						buf := r.buf[i+2 : i+j]
+						return string(buf)
+					}
 				}
 			}
 		}

+ 0 - 2
quote_publish/quote_publish.go

@@ -1,7 +1,6 @@
 package quote_publish
 
 import (
-	"fmt"
 	"mtp20access/global"
 	"mtp20access/packet"
 	"mtp20access/publish"
@@ -83,7 +82,6 @@ func (r *QuotePublish) readQuote() {
 			continue
 		}
 
-		fmt.Println(p.OriMsg)
 		// 分发给订阅者
 		global.M2A_Publish.Publish(publish.Topic_Quote, &p)
 	}