github.com/chanxuehong/wechat@v0.0.0-20230222024006-36f0325263cd/mp/bizwifi/event.go (about)

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