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

     1  package core
     2  
     3  type (
     4  	MsgType   string
     5  	EventType string
     6  )
     7  
     8  // 微信服务器推送过来的消息(事件)的通用消息头.
     9  type MsgHeader struct {
    10  	ToUserName   string  `xml:"ToUserName"   json:"ToUserName"`
    11  	FromUserName string  `xml:"FromUserName" json:"FromUserName"`
    12  	CreateTime   int64   `xml:"CreateTime"   json:"CreateTime"`
    13  	MsgType      MsgType `xml:"MsgType"      json:"MsgType"`
    14  }
    15  
    16  // 微信服务器推送过来的消息(事件)的合集.
    17  type MixedMsg struct {
    18  	XMLName struct{} `xml:"xml" json:"-"`
    19  	MsgHeader
    20  	EventType EventType `xml:"Event" json:"Event"`
    21  
    22  	MsgId        int64   `xml:"MsgId"        json:"MsgId"`        // request
    23  	Content      string  `xml:"Content"      json:"Content"`      // request
    24  	MediaId      string  `xml:"MediaId"      json:"MediaId"`      // request
    25  	PicURL       string  `xml:"PicUrl"       json:"PicUrl"`       // request
    26  	Format       string  `xml:"Format"       json:"Format"`       // request
    27  	Recognition  string  `xml:"Recognition"  json:"Recognition"`  // request
    28  	ThumbMediaId string  `xml:"ThumbMediaId" json:"ThumbMediaId"` // request
    29  	LocationX    float64 `xml:"Location_X"   json:"Location_X"`   // request
    30  	LocationY    float64 `xml:"Location_Y"   json:"Location_Y"`   // request
    31  	Scale        int     `xml:"Scale"        json:"Scale"`        // request
    32  	Label        string  `xml:"Label"        json:"Label"`        // request
    33  	Title        string  `xml:"Title"        json:"Title"`        // request
    34  	Description  string  `xml:"Description"  json:"Description"`  // request
    35  	URL          string  `xml:"Url"          json:"Url"`          // request
    36  	EventKey     string  `xml:"EventKey"     json:"EventKey"`     // request, menu
    37  	Ticket       string  `xml:"Ticket"       json:"Ticket"`       // request
    38  	Latitude     float64 `xml:"Latitude"     json:"Latitude"`     // request
    39  	Longitude    float64 `xml:"Longitude"    json:"Longitude"`    // request
    40  	Precision    float64 `xml:"Precision"    json:"Precision"`    // request
    41  	BizMsgMenuId int64   `xml:"bizmsgmenuid" json:"bizmsgmenuid"` // request
    42  	// menu
    43  	MenuId       int64 `xml:"MenuId" json:"MenuId"`
    44  	ScanCodeInfo *struct {
    45  		ScanType   string `xml:"ScanType"   json:"ScanType"`
    46  		ScanResult string `xml:"ScanResult" json:"ScanResult"`
    47  	} `xml:"ScanCodeInfo,omitempty" json:"ScanCodeInfo,omitempty"`
    48  	SendPicsInfo *struct {
    49  		Count   int `xml:"Count" json:"Count"`
    50  		PicList []struct {
    51  			PicMd5Sum string `xml:"PicMd5Sum" json:"PicMd5Sum"`
    52  		} `xml:"PicList>item,omitempty" json:"PicList,omitempty"`
    53  	} `xml:"SendPicsInfo,omitempty" json:"SendPicsInfo,omitempty"`
    54  	SendLocationInfo *struct {
    55  		LocationX float64 `xml:"Location_X" json:"Location_X"`
    56  		LocationY float64 `xml:"Location_Y" json:"Location_Y"`
    57  		Scale     int     `xml:"Scale"      json:"Scale"`
    58  		Label     string  `xml:"Label"      json:"Label"`
    59  		PoiName   string  `xml:"Poiname"    json:"Poiname"`
    60  	} `xml:"SendLocationInfo,omitempty" json:"SendLocationInfo,omitempty"`
    61  
    62  	MsgID    int64  `xml:"MsgID"  json:"MsgID"`  // template, mass
    63  	Status   string `xml:"Status" json:"Status"` // template, mass
    64  	*mass           // mass
    65  	*account        // account
    66  	*dkf            // dkf
    67  	*poi            // poi
    68  	*card           // card
    69  	*bizwifi        // bizwifi
    70  	*file           // MsgType is file
    71  
    72  	// shakearound
    73  	ChosenBeacon *struct {
    74  		UUID     string  `xml:"Uuid"     json:"Uuid"`
    75  		Major    int     `xml:"Major"    json:"Major"`
    76  		Minor    int     `xml:"Minor"    json:"Minor"`
    77  		Distance float64 `xml:"Distance" json:"Distance"`
    78  	} `xml:"ChosenBeacon,omitempty" json:"ChosenBeacon,omitempty"`
    79  	AroundBeacons []struct {
    80  		UUID     string  `xml:"Uuid"     json:"Uuid"`
    81  		Major    int     `xml:"Major"    json:"Major"`
    82  		Minor    int     `xml:"Minor"    json:"Minor"`
    83  		Distance float64 `xml:"Distance" json:"Distance"`
    84  	} `xml:"AroundBeacons>AroundBeacon,omitempty" json:"AroundBeacons,omitempty"`
    85  
    86  	UnionId string `xml:"UnionId"              json:"UnionId"` // unionId
    87  }
    88  
    89  type mass struct {
    90  	//MsgID       int64  `xml:"MsgID"       json:"MsgID"`
    91  	//Status      string `xml:"Status"      json:"Status"`
    92  	TotalCount  int `xml:"TotalCount"  json:"TotalCount"`
    93  	FilterCount int `xml:"FilterCount" json:"FilterCount"`
    94  	SentCount   int `xml:"SentCount"   json:"SentCount"`
    95  	ErrorCount  int `xml:"ErrorCount"  json:"ErrorCount"`
    96  }
    97  
    98  type account struct {
    99  	ExpiredTime int64  `xml:"ExpiredTime" json:"ExpiredTime"`
   100  	FailTime    int64  `xml:"FailTime"    json:"FailTime"`
   101  	FailReason  string `xml:"FailReason"  json:"FailReason"`
   102  }
   103  
   104  type dkf struct {
   105  	KfAccount     string `xml:"KfAccount"     json:"KfAccount"`
   106  	FromKfAccount string `xml:"FromKfAccount" json:"FromKfAccount"`
   107  	ToKfAccount   string `xml:"ToKfAccount"   json:"ToKfAccount"`
   108  }
   109  
   110  type poi struct {
   111  	UniqId string `xml:"UniqId" json:"UniqId"`
   112  	PoiId  int64  `xml:"PoiId"  json:"PoiId"`
   113  	Result string `xml:"Result" json:"Result"`
   114  	Msg    string `xml:"Msg"    json:"Msg"`
   115  }
   116  
   117  type card struct {
   118  	CardId              string `xml:"CardId"              json:"CardId"`
   119  	RefuseReason        string `xml:"RefuseReason"        json:"RefuseReason"`
   120  	IsGiveByFriend      int    `xml:"IsGiveByFriend"      json:"IsGiveByFriend"`
   121  	FriendUserName      string `xml:"FriendUserName"      json:"FriendUserName"`
   122  	UserCardCode        string `xml:"UserCardCode"        json:"UserCardCode"`
   123  	OldUserCardCode     string `xml:"OldUserCardCode"     json:"OldUserCardCode"`
   124  	ConsumeSource       string `xml:"ConsumeSource"       json:"ConsumeSource"`
   125  	OuterId             int64  `xml:"OuterId"             json:"OuterId"`
   126  	LocationName        string `xml:"LocationName"        json:"LocationName"`
   127  	StaffOpenId         string `xml:"StaffOpenId"         json:"StaffOpenId"`
   128  	VerifyCode          string `xml:"VerifyCode"          json:"VerifyCode"`
   129  	RemarkAmount        string `xml:"RemarkAmount"        json:"RemarkAmount"`
   130  	OuterStr            string `xml:"OuterStr"            json:"OuterStr"`
   131  	Detail              string `xml:"Detail"              json:"Detail"`
   132  	IsReturnBack        int    `xml:"IsReturnBack"        json:"IsReturnBack"`
   133  	IsChatRoom          int    `xml:"IsChatRoom"          json:"IsChatRoom"`
   134  	IsRestoreMemberCard int    `xml:"IsRestoreMemberCard" json:"IsRestoreMemberCard"`
   135  	IsRecommendByFriend int    `xml:"IsRecommendByFriend" json:"IsRecommendByFriend"`
   136  	PageId              string `xml:"PageId"              json:"PageId"`
   137  	OrderId             string `xml:"OrderId"             json:"OrderId"`
   138  }
   139  
   140  type bizwifi struct {
   141  	ConnectTime int64  `xml:"ConnectTime" json:"ConnectTime"`
   142  	ExpireTime  int64  `xml:"ExpireTime"  json:"ExpireTime"`
   143  	VendorId    string `xml:"VendorId"    json:"VendorId"`
   144  	PlaceId     int64  `xml:"PlaceId"     json:"PlaceId"`
   145  	DeviceNo    string `xml:"DeviceNo"    json:"DeviceNo"`
   146  }
   147  
   148  type file struct {
   149  	FileKey      string `xml:"FileKey"      json:"FileKey"`
   150  	FileMd5      string `xml:"FileMd5"      json:"FileMd5"`
   151  	FileTotalLen string `xml:"FileTotalLen" json:"FileTotalLen"`
   152  }