//接收事件消息
2 private function receiveEvent($object)
3 {
4 $content = "";
5 switch ($object->Event)
6 {
7 case "subscribe":
8 $content = "欢迎关注";
9 $content .= (!empty($object->EventKey))?(" 来自二维码场景 ".str_replace("qrscene_","",$object->EventKey)):"";
10 break;
11 case "unsubscribe":
12 $content = "取消关注";
13 break;
14 case "CLICK":
15 switch ($object->EventKey)
16 {
17 case "COMPANY":
18 $content = array();
19 $content[] = array("Title"=>"方倍工作室", "Description"=>"", "PicUrl"=>"http://discuz.comli.com/weixin/weather/icon/cartoon.jpg", "Url" =>"http://m.cnblogs.com/?u=qhorse");
20 break;
21 default:
22 $content = "点击菜单:".$object->EventKey;
23 break;
24 }
25 break;
26 case "VIEW":
27 $content = "跳转链接 ".$object->EventKey;
28 break;
29 case "SCAN":
30 $content = "扫描场景 ".$object->EventKey;
31 break;
32 case "LOCATION":
33 $content = "上传位置:纬度 ".$object->Latitude.";经度 ".$object->Longitude;
34 break;
35 case "scancode_waitmsg":
36 $content = "扫码带提示:类型 ".$object->ScanCodeInfo->ScanType." 结果:".$object->ScanCodeInfo->ScanResult;
37 break;
38 case "scancode_push":
39 $content = "扫码推事件";
40 break;
41 case "pic_sysphoto":
42 $content = "系统拍照";
43 break;
44 case "pic_weixin":
45 $content = "相册发图:数量 ".$object->SendPicsInfo->Count;
46 break;
47 case "pic_photo_or_album":
48 $content = "拍照或者相册:数量 ".$object->SendPicsInfo->Count;
49 break;
50 case "location_select":
51 $content = "发送位置:标签 ".$object->SendLocationInfo->Label;
52 break;
53 default:
54 $content = "receive a new event: ".$object->Event." 技术支持";
55 break;
56 }
57
58 if(is_array($content)){
59 if (isset($content[0]['PicUrl'])){
60 $result = $this->transmitNews($object, $content);
61 }else if (isset($content['MusicUrl'])){
62 $result = $this->transmitMusic($object, $content);
63 }
64 }else{
65 $result = $this->transmitText($object, $content);
66 }
67 return $result;
68 }
2 private function receiveEvent($object)
3 {
4 $content = "";
5 switch ($object->Event)
6 {
7 case "subscribe":
8 $content = "欢迎关注";
9 $content .= (!empty($object->EventKey))?(" 来自二维码场景 ".str_replace("qrscene_","",$object->EventKey)):"";
10 break;
11 case "unsubscribe":
12 $content = "取消关注";
13 break;
14 case "CLICK":
15 switch ($object->EventKey)
16 {
17 case "COMPANY":
18 $content = array();
19 $content[] = array("Title"=>"方倍工作室", "Description"=>"", "PicUrl"=>"http://discuz.comli.com/weixin/weather/icon/cartoon.jpg", "Url" =>"http://m.cnblogs.com/?u=qhorse");
20 break;
21 default:
22 $content = "点击菜单:".$object->EventKey;
23 break;
24 }
25 break;
26 case "VIEW":
27 $content = "跳转链接 ".$object->EventKey;
28 break;
29 case "SCAN":
30 $content = "扫描场景 ".$object->EventKey;
31 break;
32 case "LOCATION":
33 $content = "上传位置:纬度 ".$object->Latitude.";经度 ".$object->Longitude;
34 break;
35 case "scancode_waitmsg":
36 $content = "扫码带提示:类型 ".$object->ScanCodeInfo->ScanType." 结果:".$object->ScanCodeInfo->ScanResult;
37 break;
38 case "scancode_push":
39 $content = "扫码推事件";
40 break;
41 case "pic_sysphoto":
42 $content = "系统拍照";
43 break;
44 case "pic_weixin":
45 $content = "相册发图:数量 ".$object->SendPicsInfo->Count;
46 break;
47 case "pic_photo_or_album":
48 $content = "拍照或者相册:数量 ".$object->SendPicsInfo->Count;
49 break;
50 case "location_select":
51 $content = "发送位置:标签 ".$object->SendLocationInfo->Label;
52 break;
53 default:
54 $content = "receive a new event: ".$object->Event." 技术支持";
55 break;
56 }
57
58 if(is_array($content)){
59 if (isset($content[0]['PicUrl'])){
60 $result = $this->transmitNews($object, $content);
61 }else if (isset($content['MusicUrl'])){
62 $result = $this->transmitMusic($object, $content);
63 }
64 }else{
65 $result = $this->transmitText($object, $content);
66 }
67 return $result;
68 }