Skip to content

位置Location

HanSon edited this page Mar 16, 2017 · 1 revision

属性

属性 类型 含义
msg array 消息的原始数组
url string 位置链接(腾讯地图)
content string 位置文字信息

msg

Array
(
    [MsgId] => 847476418418632675
    [FromUserName] => @2aefd23a286785769c6be1cd61d53efc
    [ToUserName] => @2aefd23a286785769c6be1cd61d53efc
    [MsgType] => 1
    [Content] => 广东省广州市越秀区北京路:
/cgi-bin/mmwebwx-bin/webwxgetpubliclinkimg?url=xxx&msgid=847476418418632675&pictype=location
    [Status] => 3
    [ImgStatus] => 1
    [CreateTime] => 1484644326
    [VoiceLength] => 0
    [PlayLength] => 0
    [FileName] =>
    [FileSize] =>
    [MediaId] =>
    [Url] => http://apis.map.qq.com/uri/v1/geocoder?coord=23.118860,113.269951
    [AppMsgType] => 0
    [StatusNotifyCode] => 0
    [StatusNotifyUserName] =>
    [RecommendInfo] => Array
        (
            [UserName] =>
            [NickName] =>
            [QQNum] => 0
            [Province] =>
            [City] =>
            [Content] =>
            [Signature] =>
            [Alias] =>
            [Scene] => 0
            [VerifyFlag] => 0
            [AttrStatus] => 0
            [Sex] => 0
            [Ticket] =>
            [OpCode] => 0
        )

    [ForwardFlag] => 0
    [AppInfo] => Array
        (
            [AppID] =>
            [Type] => 0
        )

    [HasProductId] => 0
    [Ticket] =>
    [ImgHeight] => 0
    [ImgWidth] => 0
    [SubMsgType] => 48
    [NewMsgId] => 847476418418632675
    [OriContent] => <?xml version="1.0"?>
<msg>
        <location x="23.118860" y="113.269951" scale="16" label="广东省广州市越秀区北京路" maptype="0" poiname="北京路" />
</msg>

)

栗子

$robot->server->setMessageHandler(function ($message){
    // 位置信息
    if ($message instanceof Location) {
        Text::send('地图链接:'.$message->from['UserName'], $message->url);
        return '位置:'.$message;
    }
});
Clone this wiki locally