-
Notifications
You must be signed in to change notification settings - Fork 711
推荐名片Recommend
HanSon edited this page Mar 16, 2017
·
1 revision
属性 | 类型 | 含义 |
---|---|---|
msg | array | 消息的原始数组 |
info | array | 推荐信息,等同于msg['RecommendInfo'] |
bigAvatar | string | 大头像链接 |
smallAvatar | string | 小头像链接 |
isOfficial | bool | 是否公众号 |
description | string | 推荐介绍 |
province | string | 省份,中文 |
city | string | 城市,中文 |
Array
(
[MsgId] => 4849923892774473752
[FromUserName] => @@35f2d355e2168eda1e8f8f682acbd5e358945eefdc3ed815773aeb7b1fb945f4
[ToUserName] => @ab10ca37061ae6373b689a710cdcc15f528a9272f12479de9ad6d156b95992f7
[MsgType] => 42
[Content] => <?xml version="1.0"?>
<msg bigheadimgurl="http://wx.qlogo.cn/mmhead/ver_1/Qtoaa0Kb7Juib9BmOia1aicsic9WBpDpeTSzDDoneHdygtOGvvUyQ21TPIVExic8nd3x5MOLEDsbrvMu0yiatWHbKftWMryCVNAzd3EByWQJ7RAMA/0" smallheadimgurl="http://wx.qlogo.cn/mmhead/ver_1/Qtoaa0Kb7Juib9BmOia1aicsic9WBpDpeTSzDDoneHdygtOGvvUyQ21TPIVExic8nd3x5MOLEDsbrvMu0yiatWHbKftWMryCVNAzd3EByWQJ7RAMA/132" username="v1_a84634f53b575c30da570acc6915337947eb987298d4de4cfd8d674548a37a1a@stranger" nickname="Hanson" shortpy="RKS" alias="" imagestatus="3" scene="17" province="广东" city="广州" sign="" sex="1" certflag="0" certinfo="" brandIconUrl="" brandHomeUrl="" brandSubscriptConfigUrl="" brandFlags="0" regionCode="CN_Guangdong_Shantou" antispamticket="v2_ec9927542fd9a25c2423310b6db82d3ce3d7cc3dcc91d91758a0d2046d4a1d26f4f0a7b8b1e4d71e620da48392903ffe@stranger" />
[Status] => 3
[ImgStatus] => 1
[CreateTime] => 1484666214
[VoiceLength] => 0
[PlayLength] => 0
[FileName] =>
[FileSize] =>
[MediaId] =>
[Url] =>
[AppMsgType] => 0
[StatusNotifyCode] => 0
[StatusNotifyUserName] =>
[RecommendInfo] => Array
(
[UserName] => @7bb5cf7fdd288b0c10764dae9d607de6
[NickName] => HanSon
[QQNum] => 0
[Province] => Guangdong
[City] => Guangzhou
[Content] =>
[Signature] =>
[Alias] =>
[Scene] => 17
[VerifyFlag] => 0
[AttrStatus] => 32
[Sex] => 1
[Ticket] =>
[OpCode] => 0
)
[ForwardFlag] => 0
[AppInfo] => Array
(
[AppID] =>
[Type] => 0
)
[HasProductId] => 0
[Ticket] =>
[ImgHeight] => 0
[ImgWidth] => 0
[SubMsgType] => 0
[NewMsgId] => 4849923892774473752
[OriContent] =>
)
Array
(
[UserName] => @7bb5cf7fdd288b0c10764dae9d607de6
[NickName] => HanSon
[QQNum] => 0
[Province] => Guangdong
[City] => Guangzhou
[Content] =>
[Signature] =>
[Alias] =>
[Scene] => 17
[VerifyFlag] => 0
[AttrStatus] => 32
[Sex] => 1
[Ticket] =>
[OpCode] => 0
)
$robot->server->setMessageHandler(function ($message){
// 推荐名片信息
if($message instanceof Recommend){
/** @var $message Recommend */
if($message->isOfficial){
return $message->from['NickName'] . ' 向你推荐了公众号 ' . $message->province . $message->city .
" {$message->info['NickName']} 公众号信息: {$message->description}";
}else{
return $message->from['NickName'] . ' 向你推荐了 ' . $message->province . $message->city .
" {$message->info['NickName']} 头像链接: {$message->bigAvatar}";
}
}
});