Browse Source

wechat event structure

ls 5 years ago
parent
commit
319c367326
2 changed files with 10 additions and 1 deletions
  1. 5 0
      binding/binding.go
  2. 5 1
      wechat/structure.go

+ 5 - 0
binding/binding.go

@@ -128,6 +128,11 @@ func Bind(req *http.Request, obj interface{}) error {
 	return MustBindWith(req, obj, b)
 }
 
+// BindQuery query to struct
+func BindQuery(req *http.Request, obj interface{}) error {
+	return MustBindWith(req, obj, Form)
+}
+
 // MustBindWith binds the passed struct pointer using the specified binding engine.
 // It will abort the request with HTTP 400 if any error occurs.
 // See the binding package.

+ 5 - 1
wechat/structure.go

@@ -101,7 +101,11 @@ type Message struct {
 	Description string `xml:"Description,omitempty" json:"Description,omitempty"` // 消息描述
 	URL         string `xml:"Url,omitempty" json:"Url,omitempty"`                 // 消息链接
 
-	Event string `xml:"Event,omitempty" json:"Event,omitempty"` // 事件 subscribe(订阅)、unsubscribe(取消订阅)
+	Event string `xml:"Event,omitempty" json:"Event,omitempty"` // 事件 subscribe(订阅)、unsubscribe(取消订阅)、CLICK(自定义菜单事件)
+
+	// 扫描带参数二维码事件
+	EventKey string `xml:"EventKey,omitempty" json:"EventKey,omitempty"` // 事件KEY 值,扫码时 qrscene_ 为前缀,后面为二维码的参数值, 自定义菜单事件与自定义菜单接口中 KEY 值对应
+	Ticket   string `xml:"Ticket,omitempty" json:"Ticket,omitempty"`     // 二维码的ticket,可用来换取二维码图片
 
 	MsgID int64 `xml:"MsgId,omitempty" json:"MsgId,omitempty"` // 消息id
 }