Skip to content

分享Share

HanSon edited this page Mar 16, 2017 · 1 revision

属性

属性 类型 含义
msg array 消息的原始数组
title string 分享标题
description string 分享描述
url string 分享链接
app string 分享来源APP(非APP为空)

msg

 Array
  (
      [MsgId] => 7035339792379334880
      [FromUserName] => @28a357bdc0706af4d783a9a84133b4c9
      [ToUserName] => @28a357bdc0706af4d783a9a84133b4c9
      [MsgType] => 49
      [Content] => <?xml version="1.0"?>
      <msg>
      <appmsg appid="" sdkver="0">
          <title>老板你竟然给他们发这种福利?!&amp;精选暴漫</title>
          <des>这才是真·福利</des>
          <username />
          <action>view</action>
          <type>5</type>
          <showtype>0</showtype>
          <content />
          <url>http://mp.weixin.qq.com/s?__biz=MjM5NjAxMjM4MA==&amp;mid=2652267377&amp;idx=1&amp;sn=8204af7721c9dd4e36c90164f62f6ff5&amp;chksm=bd0d0b428a7a82541493fa1547a07eb0f89095cb6e90385ae7543b69f12dcae8c828f260f4d6&amp;mpshare=1&amp;scene=1&amp;srcid=0118pP681ktJmhjvhhaizNKV#rd</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>
                  <attachid />
                  <cdnthumburl>305a020100045330510201000204aa9e03a402033d14b9020471fd03b70204587ecbd0042f6175706170706d73675f336335386463623463303432313065325f313438343730343732353334395f3237323838300201000201000400</cdnthumburl>
                  <cdnthumbmd5>dfcaafc7ae177d80fecc0eb9467c1929</cdnthumbmd5>
                  <cdnthumblength>29824</cdnthumblength>
                  <cdnthumbheight>120</cdnthumbheight>
                  <cdnthumbwidth>120</cdnthumbwidth>
                  <cdnthumbaeskey>95e151d6da8f4352a4db601e59605e98</cdnthumbaeskey>
                  <aeskey>95e151d6da8f4352a4db601e59605e98</aeskey>
                  <encryver>1</encryver>
                  <fileext />
                  <islargefilemsg>0</islargefilemsg>
          </appattach>
          <extinfo />
          <androidsource>3</androidsource>
          <sourceusername>gh_8684153de4e9</sourceusername>
          <sourcedisplayname>暴走漫画</sourcedisplayname>
          <commenturl />
          <thumburl>http://mmbiz.qpic.cn/mmbiz_jpg/b1oODpqxQpbCNwhOWFNzMPbRTB5XZyGK2ED90ytuLPicx6B2hic8fzya7tE6gskjZRTydgQvV3gfJFjLQuN1uopA/300?wx_fmt=jpeg&amp;wxfrom=1</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 />
                  <appid />
                  <weappiconurl><![CDATA[null]]></weappiconurl>
          </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 />
                  <pageType>0</pageType>
          </emotionpageshared>
          <webviewshared>
                  <shareUrlOriginal />
                  <shareUrlOpen />
                  <jsAppId />
                  <publisherId />
          </webviewshared>
          <template_id>0</template_id>
          <statextstr />
          <md5 />
          <md5>dfcaafc7ae177d80fecc0eb9467c1929</md5>
      </appmsg>
      <fromusername>fasdsfsa</fromusername>
      <scene>0</scene>
      <appinfo>
              <version>1</version>
              <appname></appname>
      </appinfo>
      <commenturl></commenturl>
      </msg>
      [Status] => 3
      [ImgStatus] => 2
      [CreateTime] => 1484704721
      [VoiceLength] => 0
      [PlayLength] => 0
      [FileName] => 老板你竟然给他们发这种福利?!&amp;amp;精选暴漫
      [FileSize] =>
      [MediaId] =>
      [Url] => http://mp.weixin.qq.com/s?__biz=MjM5NjAxMjM4MA==&amp;mid=2652267377&amp;idx=1&amp;sn=8204af7721c9dd4e36c90164f62f6ff5&amp;chksm=bd0d0b428a7a82541493fa1547a07eb0f89095cb6e90385ae7543b69f12dcae8c828f260f4d6&amp;mpshare=1&amp;scene=1&amp;srcid=0118pP681ktJmhjvhhaizNKV#rd
      [AppMsgType] => 5
      [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] => 7035339792379334880
      [OriContent] =>
)

栗子

$robot->server->setMessageHandler(function ($message){
        // 分享信息
    if($message instanceof Share){
        /** @var $message Share */
        $reply = "收到分享\n标题:{$message->title}\n描述:{$message->description}\n链接:{$message->url}";
        if($message->app){
            $reply .= "\n来源APP:{$message->app}";
        }
        return $reply;
    }
});
Clone this wiki locally