forked from chanxuehong/wechat
-
Notifications
You must be signed in to change notification settings - Fork 1
/
event.go
35 lines (29 loc) · 1.15 KB
/
event.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package bizwifi
import (
"github.com/charsunny/wechat/mp/core"
)
const (
// 推送到公众号URL上的事件类型
EventTypeWifiConnected core.EventType = "WifiConnected" // Wi-Fi连网成功事件
)
type WifiConnectedEvent struct {
XMLName struct{} `xml:"xml" json:"-"`
core.MsgHeader
EventType core.EventType `xml:"Event" json:"Event"` // 事件类型,WifiConnected (Wi-Fi连网成功)
ConnectTime int64 `xml:"ConnectTime" json:"ConnectTime"` // 连网时间(整型)
ExpireTime int64 `xml:"ExpireTime" json:"ExpireTime"` // 系统保留字段,固定值
VendorId string `xml:"VendorId" json:"VendorId"` // 系统保留字段,固定值
PlaceId int64 `xml:"PlaceId" json:"PlaceId"` // 连网的门店id
DeviceNo string `xml:"DeviceNo" json:"DeviceNo"` // 连网的设备无线mac地址,对应bssid
}
func GetWifiConnectedEvent(msg *core.MixedMsg) *WifiConnectedEvent {
return &WifiConnectedEvent{
MsgHeader: msg.MsgHeader,
EventType: msg.EventType,
ConnectTime: msg.ConnectTime,
ExpireTime: msg.ExpireTime,
VendorId: msg.VendorId,
PlaceId: msg.PlaceId,
DeviceNo: msg.DeviceNo,
}
}