private function receiveText($object) { $keyword = trim($object->Content); //多客服人工回复模式 if (strstr($keyword, '您好') || strstr($keyword, '你好') || strstr($keyword, '在吗')) { $result = $this->transmitService($object); } else { //自动回复模式 if (strstr($keyword, '文本')) { $weixin = new class_weixin_adv(); $info = $weixin->get_user_info($object->FromUserName); $content = '这是个文本消息,你写的就是文本' . $info['nickname']; } else { if (strstr($keyword, '单图文')) { $content = array(); $content[] = array('Title' => '单图文标题', 'Description' => '单图文内容', 'PicUrl' => 'http://discuz.comli.com/weixin/weather/icon/cartoon.jpg', 'Url' => 'http://m.cnblogs.com/?u=txw1958'); } else { if (strstr($keyword, '图文') || strstr($keyword, '多图文')) { $content = array(); $content[] = array('Title' => '【深圳】天气实况 温度:3℃ 湿度:43﹪ 风速:西南风2级', 'Description' => '南京', 'PicUrl' => 'http://www.doucube.com/weixin/weather/icon/banner.jpg', 'Url' => 'http://m.cnblogs.com/?u=txw1958'); $content[] = array('Title' => '06月24日 周四 2℃~-7℃ 晴 北风3-4级转东南风小于3级', 'Description' => '长沙', 'PicUrl' => 'http://www.doucube.com/weixin/weather/icon/d00.gif', 'Url' => 'http://m.cnblogs.com/?u=txw1958'); $content[] = array('Title' => '06月25日 周五 -1℃~-8℃ 晴 东南风小于3级转东北风3-4级', 'Description' => '桂林', 'PicUrl' => 'http://www.doucube.com/weixin/weather/icon/d00.gif', 'Url' => 'http://m.cnblogs.com/?u=txw1958'); } else { if (strstr($keyword, '音乐')) { $content = array(); $content = array('Title' => '最炫民族风', 'Description' => '歌手:凤凰传奇', 'MusicUrl' => 'http://121.199.4.61/music/zxmzf.mp3', 'HQMusicUrl' => 'http://121.199.4.61/music/zxmzf.mp3'); } else { if (strstr($keyword, '爱')) { $content = '敬往事一杯酒,再爱不回头...'; } else { if ($keyword == '你喜欢谁') { $content = '哈哈哈哈哈哈哈'; } else { $content = '你发送的内容是:' . $object->Content . '时间:' . date('Y-m-d H:i:s', time()) . 'Alice的窝回答不了,么么哒!'; } } } } } } if (is_array($content)) { if (isset($content[0]['PicUrl'])) { $result = $this->transmitNews($object, $content); } else { if (isset($content['MusicUrl'])) { $result = $this->transmitMusic($object, $content); } } } else { $result = $this->transmitText($object, $content); } } return $result; }
// ); // foreach ($news as &$item) { // foreach ($item as $k => $v) { // $item[$k] = urlencode($v); // } // } // $data = array("articles"=>$news); // // $url = "https://api.weixin.qq.com/cgi-bin/media/uploadnews?access_token=".$this->access_token; // var_dump($data); // var_dump(json_encode($data)); // var_dump(urldecode(json_encode($data))); // var_dump(json_decode(json_encode($data))); */ $weixin = new class_weixin_adv("wx6292681b13329528", "3079cb22ad383ae7371d12aed1b2d0cc"); // var_dump($weixin->get_groups()); $openid = "oLVPpjqs9BhvzwPj5A-vTYAX3GLc"; //txw1958 在近宝 $openid2 = "oLVPpjr0hd2H_YzVRUOYNhlXN-xQ"; //fangbei2013 在近宝 $groupid = 101; // $media1 = $weixin->upload_media("thumb","banner1.jpg"); // $media2 = $weixin->upload_media("thumb","banner2.jpg"); // $media3 = $weixin->upload_media("thumb","banner3.jpg"); // // var_dump($media1); // $thumb_media_id1 = $media1["thumb_media_id"]; // $thumb_media_id2 = $media2["thumb_media_id"]; // $thumb_media_id3 = $media3["thumb_media_id"]; // // var_dump($weixin->send_custom_message($openid, "text", "你好")); $news[] = array("thumb_media_id" => $thumb_media_id1, "author" => "", "title" => "微信公众平台开发", "content_source_url" => "", "content" => "", "digest" => "");