Explorar el Código

sample kf event

master
Patrick Peng Sun hace 8 años
padre
commit
98a5e2d455
Se han modificado 2 ficheros con 19 adiciones y 2 borrados
  1. +17
    -0
      sample_data/kf_event.txt
  2. +2
    -2
      serveCommand.go

+ 17
- 0
sample_data/kf_event.txt Ver fichero

@@ -0,0 +1,17 @@
<xml><ToUserName><![CDATA[gh_f09231355c68]]></ToUserName>
<FromUserName><![CDATA[oUN420Wj78vnkNeAJY7RMPXA28oc]]></FromUserName>
<CreateTime>1495907032</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[kf_create_session]]></Event>
<KfAccount><![CDATA[kf2001@gh_f09231355c68]]></KfAccount>
</xml>


<xml><ToUserName><![CDATA[gh_f09231355c68]]></ToUserName>
<FromUserName><![CDATA[oUN420Wj78vnkNeAJY7RMPXA28oc]]></FromUserName>
<CreateTime>1495907067</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[kf_close_session]]></Event>
<KfAccount><![CDATA[kf2001@gh_f09231355c68]]></KfAccount>
<CloseType><![CDATA[KF]]></CloseType>
</xml>

+ 2
- 2
serveCommand.go Ver fichero

@@ -19,6 +19,7 @@ func echoCommand(openID string, in InWechatMsg) (state chatState, processed bool
case TextMsg:
m := in.body.(TextMsg)
str, err = BuildTextMsg(openID, m.Content)
processed = false
case PicMsg:
m := in.body.(PicMsg)
str = buildPicMsg(openID, m.MediaId)
@@ -37,9 +38,8 @@ func echoCommand(openID string, in InWechatMsg) (state chatState, processed bool
m := in.body.(LocationMsg)
mid := location2MediaID(m.Location_X, m.Location_Y)
//str, _ = BuildTextMsg(openID, fmt.Sprintf("long=%f, lat=%f, scale=%d", m.Location_X, m.Location_Y, m.Scale))
// str = buildPicMsg(openID, mid)
str = buildPicMsg(openID, mid)
url := location2URL(m.Location_X, m.Location_Y)
str, _ = BuildTextMsg(openID, mid+"\r\n"+url)
kfSendTxt(openID, url)

case LinkMsg:

Cargando…
Cancelar
Guardar