github.com/fastwego/offiaccount@v1.0.1/type/type_event/type_event.go (about)

     1  // Copyright 2020 FastWeGo
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //      http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package type_event
    16  
    17  import "github.com/fastwego/offiaccount/type/type_message"
    18  
    19  const (
    20  	EventTypeSubscribe   = "subscribe"   // 关注
    21  	EventTypeUnsubscribe = "unsubscribe" // 取关
    22  	EventTypeScan        = "SCAN"        // 已关注用户 扫码
    23  	EventTypeLocation    = "LOCATION"    // 上报位置
    24  )
    25  
    26  type Event type_message.MessageEvent
    27  
    28  /*
    29  <xml>
    30    <ToUserName><![CDATA[toUser]]></ToUserName>
    31    <FromUserName><![CDATA[FromUser]]></FromUserName>
    32    <CreateTime>123456789</CreateTime>
    33    <MsgType><![CDATA[event]]></MsgType>
    34    <Event><![CDATA[subscribe]]></Event>
    35  
    36    <EventKey><![CDATA[qrscene_123123]]></EventKey>
    37    <Ticket><![CDATA[TICKET]]></Ticket>
    38  </xml>
    39  */
    40  type EventSubscribe struct {
    41  	Event
    42  	// 扫码关注 附加参数
    43  	EventKey string
    44  	Ticket   string
    45  }
    46  
    47  /*
    48  <xml>
    49    <ToUserName><![CDATA[toUser]]></ToUserName>
    50    <FromUserName><![CDATA[FromUser]]></FromUserName>
    51    <CreateTime>123456789</CreateTime>
    52    <MsgType><![CDATA[event]]></MsgType>
    53    <Event><![CDATA[SCAN]]></Event>
    54    <EventKey><![CDATA[SCENE_VALUE]]></EventKey>
    55    <Ticket><![CDATA[TICKET]]></Ticket>
    56  </xml>
    57  */
    58  type EventScan struct {
    59  	Event
    60  	EventKey string
    61  	Ticket   string
    62  }
    63  
    64  /*
    65  <xml>
    66    <ToUserName><![CDATA[toUser]]></ToUserName>
    67    <FromUserName><![CDATA[FromUser]]></FromUserName>
    68    <CreateTime>123456789</CreateTime>
    69    <MsgType><![CDATA[event]]></MsgType>
    70    <Event><![CDATA[unsubscribe]]></Event>
    71  </xml>
    72  */
    73  type EventUnsubscribe struct {
    74  	Event
    75  }
    76  
    77  /*
    78  <xml>
    79    <ToUserName><![CDATA[toUser]]></ToUserName>
    80    <FromUserName><![CDATA[fromUser]]></FromUserName>
    81    <CreateTime>123456789</CreateTime>
    82    <MsgType><![CDATA[event]]></MsgType>
    83    <Event><![CDATA[LOCATION]]></Event>
    84    <Latitude>23.137466</Latitude>
    85    <Longitude>113.352425</Longitude>
    86    <Precision>119.385040</Precision>
    87  </xml>
    88  */
    89  type EventLocation struct {
    90  	Event
    91  	Latitude  string
    92  	Longitude string
    93  	Precision string
    94  }