Skip to content

小程序 Mina

HanSon edited this page Jan 31, 2017 · 1 revision

属性

属性 类型 含义
msg array 消息的原始数组
title string 小程序名称
url string 小程序介绍链接

msg

 Array
        (
            [MsgId] => 4439696944601366089
            [FromUserName] => @27fc0d399179f30dc6c0d353183d783b
            [ToUserName] => @27fc0d399179f30dc6c0d353183d783b
            [MsgType] => 49
            [Content] => <?xml version="1.0"?>
<msg>
        <appmsg appid="" sdkver="0">
                <title>草料二维码生成器</title>
                <des />
                <username />
                <action>view</action>
                <type>33</type>
                <showtype>0</showtype>
                <content />
                <url>https://mp.weixin.qq.com/mp/waerrpage?appid=wx5db79bd23a923e8e&amp;type=upgrade#wechat_redirect</url>
                <lowurl />
                <dataurl />
                <lowdataurl />
                <contentattr>0</contentattr>
                <streamvideo>
                        <streamvideourl />
                        <streamvideototaltime>0</streamvideototaltime>
                        <streamvideotitle />
                        <streamvideowording />
                        <streamvideoweburl />
                        <streamvideothumburl />
                        <streamvideoaduxinfo />
                        <streamvideopublishid />
                </streamvideo>
                <canvasPageItem>
                        <canvasPageXml><![CDATA[]]></canvasPageXml>
                </canvasPageItem>
                <appattach>
                        <totallen>0</totallen>
                        <attachid />
                        <cdnattachurl />
                        <emoticonmd5 />
                        <aeskey />
                        <fileext />
                        <islargefilemsg>0</islargefilemsg>
                </appattach>
                <extinfo />
                <androidsource>3</androidsource>
                <sourceusername>gh_2752dd3dd527@app</sourceusername>
                <sourcedisplayname>草料二维码生成器</sourcedisplayname>
                <commenturl />
                <thumburl>http://mmbiz.qpic.cn/mmbiz_png/tP28gkWIJNzhA0icE2Kz4BcrKhWFusqDvmeZHbatwXiaLdQPs4W6OXtz221Jh7eiakUXL51uy3VKAsls5GBGjCLJQ/0?wx_fmt=png</thumburl>
                <mediatagname />
                <messageaction><![CDATA[]]></messageaction>
                <messageext><![CDATA[]]></messageext>
                <emoticongift>
                        <packageflag>0</packageflag>
                        <packageid />
                </emoticongift>
                <emoticonshared>
                        <packageflag>0</packageflag>
                        <packageid />
                </emoticonshared>
                <weappinfo>
                        <pagepath><![CDATA[null]]></pagepath>
                        <username>gh_2752dd3dd527@app</username>
                        <appid>wx5db79bd23a923e8e</appid>
                        <type>1</type>
                </weappinfo>
                <designershared>
                        <designeruin>0</designeruin>
                        <designername>null</designername>
                        <designerrediretcturl>null</designerrediretcturl>
                </designershared>
                <emotionpageshared>
                        <tid>0</tid>
                        <title>null</title>
                        <desc>null</desc>
                        <iconUrl>null</iconUrl>
                        <secondUrl>null</secondUrl>
                        <pageType>0</pageType>
                </emotionpageshared>
                <webviewshared>
                        <shareUrlOriginal />
                        <shareUrlOpen />
                        <jsAppId />
                        <publisherId>wxapp_wx5db79bd23a923e8e</publisherId>
                </webviewshared>
                <template_id>0</template_id>
                <statextstr />
                <md5 />
        </appmsg>
        <fromusername>fasdsfsa</fromusername>
        <scene>0</scene>
        <appinfo>
                <version>1</version>
                <appname></appname>
        </appinfo>
        <commenturl></commenturl>
</msg>

            [Status] => 3
            [ImgStatus] => 1
            [CreateTime] => 1485856533
            [VoiceLength] => 0
            [PlayLength] => 0
            [FileName] => 草料二维码生成器
            [FileSize] => 0
            [MediaId] =>
            [Url] => https://mp.weixin.qq.com/mp/waerrpage?appid=wx5db79bd23a923e8e&amp;type=upgrade#wechat_redirect
            [AppMsgType] => 33
            [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] => 0
            [NewMsgId] => 4439696944601366089
            [OriContent] =>
        )

栗子

$robot->server->setMessageHandler(function ($message){
    // 分享小程序信息
    if($message instanceof Mina){
        /** @var $message Mina */
        $reply = "收到小程序\n小程序名词:{$message->title}\n链接:{$message->url}";
        return $reply;
    }
});
Clone this wiki locally