renzheng 3 rokov pred
rodič
commit
b3301d16f0
2 zmenil súbory, kde vykonal 9 pridanie a 6 odobranie
  1. 9 0
      gonsq/entity.go
  2. 0 6
      gonsq/gonsq_test.go

+ 9 - 0
gonsq/entity.go

@@ -0,0 +1,9 @@
+package gonsq
+
+//从nsq接收的消息体
+type Msg struct {
+	Id         string                 `json:"id"` //用于标识这个告警分组,及告警方式、告警人
+	Text       string                 `json:"text"`
+	Title      string                 `json:"title"`      //非必填项
+	AppendInfo map[string]interface{} `json:"appendinfo"` //附加信息,非必填项
+}

+ 0 - 6
gonsq/gonsq_test.go

@@ -44,12 +44,6 @@ func Test_arr(t *testing.T) {
 	log.Println(v, n, []byte{0xFF})
 
 	p, _ := NewProducer("192.168.3.207:4150", "jyalert", false)
-	type Msg struct {
-		Id         string                 `json:"id"` //用于标识这个告警分组,及告警方式、告警人
-		Text       string                 `json:"text"`
-		Title      string                 `json:"title"`      //非必填项
-		AppendInfo map[string]interface{} `json:"appendinfo"` //附加信息,非必填项
-	}
 	m := &Msg{"invoice_alert", "首页console错误请查看", "你有新的告警消息处理", map[string]interface{}{"ip": "127.0.0.1", "service": "sword"}}
 	bs, _ := json.Marshal(m)
 	p.Publish(bs)