private function keyword($key)
 {
     switch ($key) {
         case '首页':
         case 'home':
         case 'Home':
             return $this->home();
             break;
         case '主页':
             return $this->home();
             break;
         case '地图':
             return $this->companyMap();
         case '最近的':
             $this->recordLastRequest($key);
             //查询是否有一分钟内的经纬度
             $user_request_model = M('User_request');
             $loctionInfo = $user_request_model->where(array('token' => $this->_get('token'), 'msgtype' => 'location', 'uid' => $this->data['FromUserName']))->find();
             if ($loctionInfo && intval($loctionInfo['time'] > time() - 60)) {
                 $latLng = explode(',', $loctionInfo['keyword']);
                 return $this->map($latLng[1], $latLng[0]);
             }
             return array('请发送您所在的位置(对话框右下角点击+号,然后点击“位置”)', 'text');
             break;
         case '帮助':
             return $this->help();
             break;
         case 'help':
             return $this->help();
             break;
         case '会员卡':
             return $this->member();
             break;
         case '会员':
             return $this->member();
             break;
         case '3g相册':
             return $this->xiangce();
             break;
         case '相册':
             return $this->xiangce();
             break;
         case '商城':
             $pro = M('reply_info')->where(array('infotype' => 'Shop', 'token' => $this->token))->find();
             $url = $this->siteUrl . '/index.php?g=Wap&m=Store&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '';
             if ($pro['apiurl']) {
                 $url = str_replace('&', '&', $pro['apiurl']);
             }
             return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['picurl'], $url)), 'news');
             break;
         case '订餐':
             $pro = M('reply_info')->where(array('infotype' => 'Dining', 'token' => $this->token))->find();
             $url = $this->siteUrl . '/index.php?g=Wap&m=Repast&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '';
             if ($pro['apiurl']) {
                 $url = str_replace('&', '&', $pro['apiurl']);
             }
             return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['picurl'], $url)), 'news');
             break;
         case '留言':
             $pro = M('reply_info')->where(array('infotype' => 'message', 'token' => $this->token))->find();
             if ($pro) {
                 return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Reply&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '')), 'news');
             } else {
                 return array(array(array('留言板', '在线留言', rtrim($this->siteUrl, '/') . '/tpl/Wap/default/common/css/style/images/ly.jpg', $this->siteUrl . '/index.php?g=Wap&m=Reply&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '')), 'news');
             }
             break;
         case '酒店':
             $pro = M('reply_info')->where(array('infotype' => 'Hotels', 'token' => $this->token))->find();
             if ($pro) {
                 return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Hotels&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'])), 'news');
             } else {
                 return array(array(array('酒店', '酒店在线预订', rtrim($this->siteUrl, '/') . 'tpl/static/images/homelogo.png', $this->siteUrl . '/index.php?g=Wap&m=Hotels&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'])), 'news');
             }
             break;
         case '团购':
             $pro = M('reply_info')->where(array('infotype' => 'Groupon', 'token' => $this->token))->find();
             $url = $this->siteUrl . '/index.php?g=Wap&m=Groupon&a=grouponIndex&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '';
             if ($pro['apiurl']) {
                 $url = str_replace('&', '&', $pro['apiurl']);
             }
             return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['picurl'], $url)), 'news');
             break;
         case '全景':
             $pro = M('reply_info')->where(array('infotype' => 'panorama', 'token' => $this->token))->find();
             if ($pro) {
                 return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Panorama&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '')), 'news');
             } else {
                 return array(array(array('360°全景看车看房', '通过该功能可以实现3D全景看车看房', rtrim($this->siteUrl, '/') . '/tpl/User/default/common/images/panorama/360view.jpg', $this->siteUrl . '/index.php?g=Wap&m=Panorama&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '')), 'news');
             }
             break;
         case '讨论社区':
         case '论坛':
             $fconfig = M('Forum_config')->where(array('token' => $this->token))->find();
             return array(array(array($fconfig['forumname'], str_replace(' ', '', strip_tags(htmlspecialchars_decode($fconfig['intro']))), $fconfig['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Forum&a=index&&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'])), 'news');
             break;
         case '微商圈':
             $thisItem = M('Market')->where(array('token' => $this->token))->find();
             return array(array(array($thisItem['title'], $thisItem['address'], $thisItem['logo_pic'], $this->siteUrl . U('Wap/Market/index', array('token' => $this->token, 'wecha_id' => $this->data['FromUserName'])))), 'news');
             break;
             break;
         case '微房产':
             $Estate = M('Estate')->where(array('token' => $this->token))->find();
             return array(array(array($Estate['title'], str_replace(' ', '', strip_tags(htmlspecialchars_decode($Estate['estate_desc']))), $Estate['cover'], $this->siteUrl . '/index.php?g=Wap&m=Estate&a=index&&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&hid=' . $Estate['id'] . '')), 'news');
             break;
         case '吃粽子':
             $pro = M('czzreply_info')->where(array('token' => $this->token))->find();
             return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Czz&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'])), 'news');
             break;
         case '2048加强版':
             $pro = M('gametreply_info')->where(array('token' => $this->token))->find();
             return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Gamet&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'])), 'news');
             break;
         case 'fly2048':
             $pro = M('gamettreply_info')->where(array('token' => $this->token))->find();
             return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Gamett&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'])), 'news');
             break;
     }
     $check = $this->user('diynum', $key);
     if ($check['diynum'] != 1) {
         return array(C('connectout'), 'text');
     }
     $like['keyword'] = $key;
     $like['precisions'] = 1;
     $like['token'] = $this->token;
     $data = M('keyword')->where($like)->order('id desc')->find();
     if (!$data) {
         $like['keyword'] = array('like', '%' . $key . '%');
         $like['precisions'] = 0;
         $data = M('keyword')->where($like)->order('id desc')->find();
     }
     if ($data != false) {
         $this->behaviordata($data['module'], $data['pid']);
         $replyClassName = $data['module'] . 'Reply';
         if (class_exists($replyClassName)) {
             $replyClass = new $replyClassName($this->token, $this->data['FromUserName'], $data, $this->siteUrl);
             return $replyClass->index();
         } else {
             switch ($data['module']) {
                 case 'Img':
                     $this->requestdata('imgnum');
                     $img_db = M($data['module']);
                     $back = $img_db->field('id,text,pic,url,title')->limit(9)->order('usort desc')->where($like)->select();
                     if ($back == false) {
                         return array('‘' . $data['keyword'] . '’无此图文信息或图片,请提醒商家,重新设定关键词', 'text');
                     }
                     $idsWhere = 'id in (';
                     $comma = '';
                     foreach ($back as $keya => $infot) {
                         $idsWhere .= $comma . $infot['id'];
                         $comma = ',';
                         if ($infot['url'] != false) {
                             //处理外链
                             if (!(strpos($infot['url'], 'http') === FALSE)) {
                                 $url = $this->getFuncLink(html_entity_decode($infot['url']));
                             } else {
                                 //内部模块的外链
                                 $url = $this->getFuncLink($infot['url']);
                             }
                         } else {
                             $url = rtrim($this->siteUrl, '/') . U('Wap/Index/content', array('token' => $this->token, 'id' => $infot['id'], 'wecha_id' => $this->data['FromUserName']));
                         }
                         $return[] = array($infot['title'], $this->handleIntro($infot['text']), $infot['pic'], $url);
                     }
                     $idsWhere .= ')';
                     if ($back) {
                         $img_db->where($idsWhere)->setInc('click');
                     }
                     return array($return, 'news');
                     break;
                 case 'Host':
                     $this->requestdata('other');
                     $host = M('Host')->where(array('id' => $data['pid']))->find();
                     return array(array(array($host['name'], $host['info'], $host['ppicurl'], $this->siteUrl . '/index.php?g=Wap&m=Host&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&hid=' . $data['pid'] . '')), 'news');
                     break;
                 case 'Reservation':
                     $this->requestdata('other');
                     $rt = M('Reservation')->where(array('id' => $data['pid']))->find();
                     if (!strpos($rt['picurl'], 'ttp:')) {
                         $rt['picurl'] = $this->siteUrl . $rt['picurl'];
                     }
                     return array(array(array($rt['title'], str_replace(array(' ', 'br /', '&', 'gt;', 'lt;'), '', strip_tags(htmlspecialchars_decode($rt['info']))), $rt['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Reservation&a=index&rid=' . $data['pid'] . '&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '')), 'news');
                     break;
                 case 'Text':
                     $this->requestdata('textnum');
                     $info = M($data['module'])->order('id desc')->find($data['pid']);
                     return array(htmlspecialchars_decode(str_replace('{wechat_id}', $this->data['FromUserName'], $info['text'])), 'text');
                     break;
                 case 'Product':
                     $this->requestdata('other');
                     $infos = M('Product')->limit(9)->order('id desc')->where($like)->select();
                     if ($infos) {
                         $return = array();
                         foreach ($infos as $info) {
                             if (!$info['groupon']) {
                                 $url = $this->siteUrl . '/index.php?g=Wap&m=Store&a=product&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $info['id'];
                             } else {
                                 $url = $this->siteUrl . '/index.php?g=Wap&m=Groupon&a=product&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $info['id'];
                             }
                             $return[] = array($info['name'], $this->handleIntro(strip_tags(htmlspecialchars_decode($info['intro']))), $info['logourl'], $url);
                         }
                     }
                     return array($return, 'news');
                     break;
                 case 'Selfform':
                     $this->requestdata('other');
                     $pro = M('Selfform')->where(array('id' => $data['pid']))->find();
                     return array(array(array($pro['name'], strip_tags(htmlspecialchars_decode($pro['intro'])), $pro['logourl'], $this->siteUrl . '/index.php?g=Wap&m=Selfform&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . '')), 'news');
                     break;
                 case 'Custom':
                     $this->requestdata('other');
                     $pro = M('Custom_set')->where(array('set_id' => $data['pid']))->find();
                     return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['intro'])), $pro['top_pic'], $this->siteUrl . '/index.php?g=Wap&m=Custom&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . '')), 'news');
                     break;
                 case 'Panorama':
                     $this->requestdata('other');
                     $pro = M('Panorama')->where(array('id' => $data['pid']))->find();
                     return array(array(array($pro['name'], strip_tags(htmlspecialchars_decode($pro['intro'])), $pro['frontpic'], $this->siteUrl . '/index.php?g=Wap&m=Panorama&a=item&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . '')), 'news');
                     break;
                 case 'Wedding':
                     $this->requestdata('other');
                     $wedding = M('Wedding')->where(array('id' => $data['pid']))->find();
                     return array(array(array($wedding['title'], strip_tags(htmlspecialchars_decode($wedding['word'])), $wedding['coverurl'], $this->siteUrl . '/index.php?g=Wap&m=Wedding&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . ''), array('查看我的祝福', strip_tags(htmlspecialchars_decode($wedding['word'])), $wedding['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Wedding&a=check&type=1&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . ''), array('查看我的来宾', strip_tags(htmlspecialchars_decode($wedding['word'])), $wedding['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Wedding&a=check&type=2&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . '')), 'news');
                     break;
                 case 'Vote':
                     $this->requestdata('other');
                     $Vote = M('Vote')->where(array('id' => $data['pid']))->order('id DESC')->find();
                     return array(array(array($Vote['title'], '', $Vote['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Vote&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . '')), 'news');
                     break;
                 case 'Greeting_card':
                     $this->requestdata('other');
                     $Vote = M('Greeting_card')->where(array('id' => $data['pid']))->order('id DESC')->find();
                     return array(array(array($Vote['title'], str_replace(array(' ', 'br /', '&', 'gt;', 'lt;'), '', strip_tags(htmlspecialchars_decode($Vote['info']))), $Vote['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Greeting_card&a=index&id=' . $data['pid'] . '')), 'news');
                     break;
                 case 'Estate':
                     $this->requestdata('other');
                     $Estate = M('Estate')->where(array('id' => $data['pid']))->find();
                     return array(array(array($Estate['title'], $Estate['estate_desc'], $Estate['cover'], $this->siteUrl . '/index.php?g=Wap&m=Estate&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . ''), array('楼盘介绍', $Estate['estate_desc'], $Estate['house_banner'], $this->siteUrl . '/index.php?g=Wap&m=Estate&a=index&&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&hid=' . $data['pid'] . ''), array('专家点评', $Estate['estate_desc'], $Estate['cover'], $this->siteUrl . '/index.php?g=Wap&m=Estate&a=impress&&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&hid=' . $data['pid'] . ''), array('楼盘3D全景', $Estate['estate_desc'], $Estate['banner'], $this->siteUrl . '/index.php?g=Wap&m=Panorama&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&hid=' . $data['pid'] . ''), array('楼盘动态', $Estate['estate_desc'], $Estate['house_banner'], $this->siteUrl . '/index.php?g=Wap&m=Index&a=lists&classid=' . $Estate['classify_id'] . '&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&hid=' . $data['pid'] . '')), 'news');
                     break;
                 case 'Invites':
                     $this->requestdata('other');
                     $info = M('Invites')->where(array('id' => $data['pid']))->find();
                     if ($info == false) {
                         return array('商家未做邀请回复配置,请稍后再试', 'text');
                     }
                     return array(array(array($info['title'], $this->handleIntro($info['brief']), $info['picurl'], C('site_url') . U('Wap/Invites/index', array('token' => $this->token, 'id' => $info['id'])))), 'news');
                     break;
                 case 'Vcard':
                     $this->requestdata('other');
                     $vcard = M('vcard_list')->where(array('token' => $this->token, 'name' => $key))->find();
                     if ($vcard) {
                         return array(array(array($vcard['name'], $vcard['work'], $vcard['image'], $this->siteUrl . U('Wap/Vcard/index', array('token' => $this->token, 'wecha_id' => $this->data['FromUserName'], 'id' => $vcard['id'])))), 'news');
                     }
                     break;
                 case 'Paper':
                     $this->requestdata('other');
                     $Paper = M('Paper')->where(array('id' => $data['pid']))->find();
                     return array(array(array($Paper['title'], strip_tags(htmlspecialchars_decode($Paper['title'])), $Paper['pic'], $this->siteUrl . '/index.php?g=Wap&m=Paper&a=item&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . '')), 'news');
                     break;
                 case 'Jiejing':
                     $this->requestdata('other');
                     $Jiejing = M('Jiejing')->where(array('token' => $data['token']))->find();
                     $url = 'http://apis.map.qq.com/uri/v1/streetview?pano=' . $Jiejing['pano'] . '&heading=30&pitch=10';
                     return array(array(array($Jiejing['title'], $Jiejing['text'], C('site_url') . $Jiejing['picurl'], $url)), 'news');
                     break;
                 case 'RippleOS_url':
                     $this->requestdata('textnum');
                     $node = D('Rippleos_node')->where(array('id' => $data['pid']))->find();
                     $ret_json = $this->rippleos_auth_url($node['node']);
                     if (is_array($node) && $ret_json['status'] === 0) {
                         $ret = '<a href="' . $ret_json['auth_url'] . '">' . $node['text'] . '</a>';
                     } else {
                         $ret = $this->rptk_err_msg[abs($ret_json['status'])];
                     }
                     return array(htmlspecialchars_decode($ret), 'text');
                     break;
                 case 'RippleOS_code':
                     $this->requestdata('textnum');
                     $node = D('Rippleos_node')->where(array('id' => $data['pid']))->find();
                     $ret_json = $this->rippleos_auth_token($node['node']);
                     if (is_array($node) && $ret_json['status'] === 0) {
                         $ret = '上网验证码:' . $ret_json['auth_token'] . '(验证码有效期为10分钟)';
                     } else {
                         $ret = $this->rptk_err_msg[abs($ret_json['status'])];
                     }
                     return array(htmlspecialchars_decode($ret), 'text');
                     break;
                 case 'Lottery':
                     $this->requestdata('other');
                     $info = M('Lottery')->find($data['pid']);
                     if ($info == false || $info['status'] == 3) {
                         return array('活动可能已经结束或者被删除了', 'text');
                     }
                     switch ($info['type']) {
                         case 1:
                             $model = 'Lottery';
                             break;
                         case 2:
                             $model = 'Guajiang';
                             break;
                         case 3:
                             $model = 'Coupon';
                             break;
                         case 4:
                             $model = 'LuckyFruit';
                             break;
                         case 5:
                             $model = 'GoldenEgg';
                             break;
                         case 7:
                             $model = 'AppleGame';
                             break;
                         case 8:
                             $model = 'Lovers';
                             break;
                         case 9:
                             $model = 'Autumn';
                             break;
                     }
                     $id = $info['id'];
                     $type = $info['type'];
                     if ($info['status'] == 1) {
                         $picurl = $info['starpicurl'];
                         $title = $info['title'];
                         $id = $info['id'];
                         $info = $info['info'];
                     } else {
                         $picurl = $info['endpicurl'];
                         $title = $info['endtite'];
                         $info = $info['endinfo'];
                     }
                     $url = $this->siteUrl . U('Wap/' . $model . '/index', array('token' => $this->token, 'type' => $type, 'wecha_id' => $this->data['FromUserName'], 'id' => $id, 'type' => $type));
                     return array(array(array($title, $info, $picurl, $url)), 'news');
                 case 'Carowner':
                     $this->requestdata('other');
                     $thisItem = M('Carowner')->where(array('id' => $data['pid']))->find();
                     return array(array(array($thisItem['title'], str_replace(array('&nbsp;', 'br /', '&amp;', 'gt;', 'lt;'), '', strip_tags(htmlspecialchars_decode($thisItem['info']))), $thisItem['head_url'], $this->siteUrl . '/index.php?g=Wap&m=Car&a=owner&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . '')), 'news');
                     break;
                 case 'Carowner':
                     $this->requestdata('other');
                     $thisItem = M('Carowner')->where(array('id' => $data['pid']))->find();
                     return array(array(array($thisItem['title'], str_replace(array('&nbsp;', 'br /', '&amp;', 'gt;', 'lt;'), '', strip_tags(htmlspecialchars_decode($thisItem['info']))), $thisItem['head_url'], $this->siteUrl . '/index.php?g=Wap&m=Car&a=owner&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'])), 'news');
                     break;
                 case 'Carset':
                     $this->requestdata('other');
                     $thisItem = M('Carset')->where(array('id' => $data['pid']))->find();
                     $news = array();
                     array_push($news, array($thisItem['title'], '', $thisItem['head_url'], $thisItem['url'] ? $thisItem['url'] : $this->siteUrl . '/index.php?g=Wap&m=Car&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName']));
                     array_push($news, array($thisItem['title1'], '', $thisItem['head_url_1'], $thisItem['url1'] ? $thisItem['url1'] : $this->siteUrl . '/index.php?g=Wap&m=Car&a=brands&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName']));
                     array_push($news, array($thisItem['title2'], '', $thisItem['head_url_2'], $thisItem['url2'] ? $thisItem['url2'] : $this->siteUrl . '/index.php?g=Wap&m=Car&a=salers&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName']));
                     array_push($news, array($thisItem['title3'], '', $thisItem['head_url_3'], $thisItem['url3'] ? $thisItem['url3'] : $this->siteUrl . '/index.php?g=Wap&m=Car&a=CarReserveBook&addtype=drive&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName']));
                     array_push($news, array($thisItem['title4'], '', $thisItem['head_url_4'], $thisItem['url4'] ? $thisItem['url4'] : $this->siteUrl . '/index.php?g=Wap&m=Car&a=owner&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName']));
                     array_push($news, array($thisItem['title5'], '', $thisItem['head_url_5'], $thisItem['url5'] ? $thisItem['url5'] : $this->siteUrl . '/index.php?g=Wap&m=Car&a=tool&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName']));
                     array_push($news, array($thisItem['title6'], '', $thisItem['head_url_6'], $thisItem['url6'] ? $thisItem['url6'] : $this->siteUrl . '/index.php?g=Wap&m=Car&a=showcar&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName']));
                     return array($news, 'news');
                     break;
                 case 'medicalSet':
                     $thisItem = M('Medical_set')->where(array('id' => $data['pid']))->find();
                     return array(array(array($thisItem['title'], str_replace(array('&nbsp;', 'br /', '&amp;', 'gt;', 'lt;'), '', strip_tags(htmlspecialchars_decode($thisItem['info']))), $thisItem['head_url'], $this->siteUrl . '/index.php?g=Wap&m=Medical&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'])), 'news');
                     break;
                 case 'Wall':
                 case 'Scene':
                     if ($data['module'] == 'Wall') {
                         $act_model = M('Wall');
                     } else {
                         $act_model = M('Wechat_scene');
                     }
                     $thisItem = $act_model->where(array('id' => $data['pid']))->find();
                     if ($data['module'] == 'Wall') {
                         $acttype = 1;
                         $isopen = $thisItem['isopen'];
                         $picLogo = $thisItem['startbackground'];
                     } else {
                         $acttype = 3;
                         $isopen = $thisItem['is_open'];
                         $picLogo = $thisItem['pic'];
                     }
                     $str = $this->wallStr($acttype, $thisItem);
                     if (!$isopen) {
                         return array($thisItem['title'] . '活动已关闭', 'text');
                     } else {
                         $actid = $data['pid'];
                         $memberRecord = M('Wall_member')->where(array('act_id' => $actid, 'act_type' => $acttype, 'wecha_id' => $this->data['FromUserName']))->find();
                         if (!$memberRecord) {
                             return array(array(array($thisItem['title'], '请点击这里完善信息后再参加此活动', $picLogo, $this->siteUrl . U('Wap/Scene_member/index', array('token' => $this->token, 'wecha_id' => $this->data['FromUserName'], 'act_type' => $acttype, 'id' => $actid, 'name' => 'wall')))), 'news');
                         } else {
                             M('Userinfo')->where(array('token' => $this->token, 'wecha_id' => $this->data['FromUserName']))->save(array('wallopen' => 1));
                             S('fans_' . $this->token . '_' . $this->data['FromUserName'], NULL);
                             return array($str, 'text');
                         }
                     }
                     break;
                 case 'Recipe':
                     $this->requestdata('other');
                     $thisItem = M('Recipe')->where(array('id' => $data['pid']))->find();
                     return array(array(array($thisItem['title'], str_replace(array('&nbsp;', 'br /', '&amp;', 'gt;', 'lt;'), '', strip_tags(htmlspecialchars_decode($thisItem['infos']))), $thisItem['headpic'], $this->siteUrl . '/index.php?g=Wap&m=Recipe&a=index&token=' . $this->token . '&type=' . $thisItem['type'] . '&id=' . $thisItem['id'] . 'wecha_id=' . $this->data['FromUserName'])), 'news');
                     break;
                 case 'Router_config':
                     $routerUrl = Router::login($this->token, $this->data['FromUserName']);
                     $thisItem = M('Router_config')->where(array('id' => $data['pid']))->find();
                     return array(array(array($thisItem['title'], $thisItem['info'], $thisItem['picurl'], $routerUrl)), 'news');
                     break;
                 case 'Schoolset':
                     $thisItem = M('School_set_index')->where(array('setid' => $data['pid']))->find();
                     return array(array(array($thisItem['title'], $thisItem['info'], $thisItem['head_url'], $this->siteUrl . U('Wap/School/index', array('token' => $this->token, 'wecha_id' => $this->data['FromUserName'])))), 'news');
                     break;
                 case 'Research':
                     $thisItem = M('Research')->where(array('id' => $data['pid']))->find();
                     return array(array(array($thisItem['title'], $thisItem['description'], $thisItem['logourl'], $this->siteUrl . U('Wap/Research/index', array('reid' => $data['pid'], 'token' => $this->token, 'wecha_id' => $this->data['FromUserName'])))), 'news');
                     break;
                 case 'Business':
                     $this->requestdata('other');
                     $thisItem = M('Busines')->where(array('bid' => $data['pid']))->find();
                     return array(array(array($thisItem['title'], str_replace(array('&nbsp;', 'br /', '&amp;', 'gt;', 'lt;'), '', strip_tags(htmlspecialchars_decode($thisItem['business_desc']))), $thisItem['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Business&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&bid=' . $thisItem['bid'] . '&type=' . $thisItem['type'])), 'news');
                     break;
                 case 'Sign':
                     $thisItem = M('Sign_set')->where(array('id' => $data['pid']))->find();
                     return array(array(array($thisItem['title'], $thisItem['content'], $thisItem['reply_img'], $this->siteUrl . U('Wap/Fanssign/index', array('token' => $this->token, 'wecha_id' => $this->data['FromUserName'], 'id' => $data['pid'])))), 'news');
                     break;
                 case 'Multi':
                     $multiImgClass = new multiImgNews($this->token, $this->data['FromUserName'], $this->siteUrl);
                     return $multiImgClass->news($data['pid']);
                     break;
                 case 'Market':
                     $thisItem = M('Market')->where(array('market_id' => $data['pid']))->find();
                     return array(array(array($thisItem['title'], $thisItem['address'], $thisItem['logo_pic'], $this->siteUrl . U('Wap/Market/index', array('token' => $this->token, 'wecha_id' => $this->data['FromUserName'])))), 'news');
                 default:
                     $replyClassName = $data['module'] . 'Reply';
                     if (class_exists($replyClassName)) {
                         $replyClass = new $replyClassName($this->token, $this->data['FromUserName'], $data, $this->siteUrl);
                         return $replyClass->index();
                     } else {
                         $this->requestdata('videonum');
                         $info = M($data['module'])->order('id desc')->find($data['pid']);
                         return array(array($info['title'], $info['keyword'], $info['musicurl'], $info['hqmusicurl']), 'music');
                     }
             }
         }
     } else {
         $nokeywordReply = $this->nokeywordApi();
         if ($nokeywordReply) {
             return $nokeywordReply;
         }
         if ($this->wxuser['transfer_customer_service']) {
             return array('turn on transfer_customer_service', 'transfer_customer_service');
         }
         $chaFfunction = M('Function')->where(array('funname' => 'liaotian'))->find();
         if (!strpos($this->fun, 'liaotian') || !$chaFfunction['status']) {
             $other = M('Other')->where(array('token' => $this->token))->find();
             if ($other == false) {
                 return array('请在平台里设置回答不上来的回复', 'text');
             } else {
                 if (empty($other['keyword'])) {
                     return array($other['info'], 'text');
                 } else {
                     $img = M('Img')->field('id,text,pic,url,title')->limit(10)->order('usort desc')->where(array('token' => $this->token, 'keyword' => array('like', '%' . $other['keyword'] . '%')))->select();
                     if ($img == false) {
                         $multiImgs = M('Img_multi')->where(array('token' => $this->token, 'keywords' => array('like', '%' . $other['keyword'] . '%')))->find();
                         if (!$multiImgs) {
                             return array('无此图文信息,请提醒商家,重新设定关键词', 'text');
                         } else {
                             $multiImgClass = new multiImgNews($this->token, $this->data['FromUserName'], $this->siteUrl);
                             return $multiImgClass->news($multiImgs['id']);
                         }
                     }
                     foreach ($img as $keya => $infot) {
                         if ($infot['url'] != false) {
                             //处理外链
                             if (!(strpos($infot['url'], 'http') === FALSE)) {
                                 $url = $this->getFuncLink(html_entity_decode($infot['url']));
                             } else {
                                 //内部模块的外链
                                 $url = $this->getFuncLink($infot['url']);
                             }
                         } else {
                             $url = rtrim($this->siteUrl, '/') . U('Wap/Index/content', array('token' => $this->token, 'id' => $infot['id'], 'wecha_id' => $this->data['FromUserName']));
                         }
                         $return[] = array($infot['title'], $infot['text'], $infot['pic'], $url);
                     }
                     return array($return, 'news');
                 }
             }
         }
         if (!C('not_support_chat')) {
             $this->selectService();
         }
         return array($this->chat($key), 'text');
     }
 }
 private function keyword($key)
 {
     switch ($key) {
         case '首页':
         case 'home':
             return $this->home();
             break;
         case '主页':
             return $this->home();
             break;
         case '地图':
             return $this->companyMap();
         case '最近的':
             $this->recordLastRequest($key);
             $user_request_model = M('User_request');
             $loctionInfo = $user_request_model->where(array('token' => $this->_get('token'), 'msgtype' => 'location', 'uid' => $this->data['FromUserName']))->find();
             if ($loctionInfo && intval($loctionInfo['time'] > time() - 60)) {
                 $latLng = explode(',', $loctionInfo['keyword']);
                 return $this->map($latLng[1], $latLng[0]);
             }
             return array("试试发送你的位置,寻找离你最近的门店:\n 1.点击右下方“+号键”\n 2.点击“位置”图标 \n 3.完成定位后点击“发送”\n 期待你的光临哦!/拥抱", 'text');
             break;
         case 'help':
         case '帮助':
             return $this->help();
             break;
         case '会员卡':
             return $this->member();
             break;
         case '会员':
             return $this->member();
             break;
         case '3g相册':
             return $this->xiangce();
             break;
         case '相册':
             return $this->xiangce();
             break;
         case '商城':
             $pro = M('reply_info')->where(array('infotype' => 'Shop', 'token' => $this->token))->find();
             $url = $this->siteUrl . '/index.php?g=Wap&m=Store&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '';
             if ($pro['apiurl']) {
                 $url = str_replace('&amp;', '&', $pro['apiurl']);
             }
             return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['picurl'], $url)), 'news');
             break;
         case '订餐':
             $pro = M('reply_info')->where(array('infotype' => 'Dining', 'token' => $this->token))->find();
             $url = $this->siteUrl . '/index.php?g=Wap&m=Repast&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '';
             if ($pro['apiurl']) {
                 $url = str_replace('&amp;', '&', $pro['apiurl']);
             }
             return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['picurl'], $url)), 'news');
             break;
         case '留言':
             $pro = M('reply_info')->where(array('infotype' => 'message', 'token' => $this->token))->find();
             if ($pro) {
                 return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Reply&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '')), 'news');
             } else {
                 return array(array(array('留言板', '在线留言', rtrim($this->siteUrl, '/') . '/tpl/Wap/default/common/css/style/images/ly.jpg', $this->siteUrl . '/index.php?g=Wap&m=Reply&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '')), 'news');
             }
             break;
         case '酒店':
             $pro = M('reply_info')->where(array('infotype' => 'Hotels', 'token' => $this->token))->find();
             if ($pro) {
                 return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Hotels&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'])), 'news');
             } else {
                 return array(array(array('酒店', '酒店在线预订', rtrim($this->siteUrl, '/') . 'tpl/static/images/homelogo.png', $this->siteUrl . '/index.php?g=Wap&m=Hotels&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'])), 'news');
             }
             break;
         case '团购':
             $pro = M('reply_info')->where(array('infotype' => 'Groupon', 'token' => $this->token))->find();
             $url = $this->siteUrl . '/index.php?g=Wap&m=Groupon&a=grouponIndex&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '';
             if ($pro['apiurl']) {
                 $url = str_replace('&amp;', '&', $pro['apiurl']);
             }
             return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['picurl'], $url)), 'news');
             break;
         case '全景':
             $pro = M('reply_info')->where(array('infotype' => 'panorama', 'token' => $this->token))->find();
             if ($pro) {
                 return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Panorama&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '')), 'news');
             } else {
                 return array(array(array('360°全景看车看房', '通过该功能可以实现3D全景看车看房', rtrim($this->siteUrl, '/') . '/tpl/User/default/common/images/panorama/360view.jpg', $this->siteUrl . '/index.php?g=Wap&m=Panorama&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '')), 'news');
             }
             break;
         case '微房产':
             $Estate = M('Estate')->where(array('token' => $this->token))->find();
             return array(array(array($Estate['title'], str_replace('&nbsp;', '', strip_tags(htmlspecialchars_decode($Estate['estate_desc']))), $Estate['cover'], $this->siteUrl . '/index.php?g=Wap&m=Estate&a=index&&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&hid=' . $Estate['id'] . '')), 'news');
             break;
         case '讨论社区':
         case '论坛':
             $fconfig = M('Forum_config')->where(array('token' => $this->token))->find();
             return array(array(array($fconfig['forumname'], str_replace('&nbsp;', '', strip_tags(htmlspecialchars_decode($fconfig['intro']))), $fconfig['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Forum&a=index&&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'])), 'news');
             break;
         case '微信签到':
             $thisItem = M('Sign_set')->where(array('token' => $this->token))->find();
             return array(array(array($thisItem['title'], $thisItem['content'], $thisItem['reply_img'], $this->siteUrl . U('Wap/Fanssign/index', array('token' => $this->token, 'wecha_id' => $this->data['FromUserName'])))), 'news');
             break;
         case '微商圈':
             $thisItem = M('Market')->where(array('token' => $this->token))->find();
             return array(array(array($thisItem['title'], $thisItem['address'], $thisItem['logo_pic'], $this->siteUrl . U('Wap/Market/index', array('token' => $this->token, 'wecha_id' => $this->data['FromUserName'])))), 'news');
             break;
         case '神经猫':
             $pro = M('cat_set')->where(array('token' => $this->token))->find();
             $url = $this->siteUrl . '/index.php?g=Wap&m=Cat&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '';
             return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['text'])), $pro['picurl'], $url)), 'news');
             break;
         case '吃粽子':
             $pro = M('czzreply_info')->where(array('token' => $this->token))->find();
             $url = $this->siteUrl . '/index.php?g=Wap&m=Czz&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '';
             return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['picurl'], $url)), 'news');
             break;
         case '2048':
             $pro = M('gamereply_info')->where(array('token' => $this->token))->find();
             $url = $this->siteUrl . '/index.php?g=Wap&m=Game&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '';
             return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['picurl'], $url)), 'news');
             break;
         case '2048加强版':
             $pro = M('gametreply_info')->where(array('token' => $this->token))->find();
             $url = $this->siteUrl . '/index.php?g=Wap&m=Gamet&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '';
             return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['picurl'], $url)), 'news');
             break;
         case 'fly2048':
             $pro = M('gamettreply_info')->where(array('token' => $this->token))->find();
             $url = $this->siteUrl . '/index.php?g=Wap&m=Gamett&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '';
             return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['picurl'], $url)), 'news');
             break;
     }
     $check = $this->user('diynum', $key);
     if ($check['diynum'] != 1) {
         return array(C('connectout'), 'text');
     }
     $like['keyword'] = array('like', '%' . $key . '%');
     $like['token'] = $this->token;
     $data = M('keyword')->where($like)->order('id desc')->find();
     if ($data != false) {
         $this->behaviordata($data['module'], $data['pid']);
         switch ($data['module']) {
             case 'Img':
                 $this->requestdata('imgnum');
                 $img_db = M($data['module']);
                 //修改以sort来排序
                 $like['pic'] = array('neq', '');
                 $back = $img_db->field('id,text,pic,url,title')->limit(9)->order('usort desc,id DESC')->where($like)->select();
                 if ($back == false) {
                     return array('‘' . $data['keyword'] . '’无此图文信息或图片,请提醒商家,重新设定关键词', 'text');
                 }
                 $idsWhere = 'id in (';
                 $comma = '';
                 foreach ($back as $keya => $infot) {
                     $idsWhere .= $comma . $infot['id'];
                     $comma = ',';
                     if ($infot['url'] != false) {
                         if (!(strpos($infot['url'], 'http') === FALSE)) {
                             $url = $this->getFuncLink(html_entity_decode($infot['url']));
                         } else {
                             $url = $this->getFuncLink($infot['url']);
                         }
                     } else {
                         $url = rtrim(C('site_url'), '/') . U('Wap/Index/content', array('token' => $this->token, 'id' => $infot['id'], 'wecha_id' => $this->data['FromUserName']));
                     }
                     $return[] = array($infot['title'], $this->handleIntro($infot['text']), $infot['pic'], $url);
                 }
                 $idsWhere .= ')';
                 if ($back) {
                     $img_db->where($idsWhere)->setInc('click');
                 }
                 return array($return, 'news');
                 break;
             case 'RippleOS_url':
                 $this->requestdata('textnum');
                 $node = D('Rippleos_node')->where(array('id' => $data['pid']))->find();
                 $ret_json = $this->rippleos_auth_url($node['node']);
                 if (is_array($node) && $ret_json['status'] === 0) {
                     $ret = '<a href="' . $ret_json['auth_url'] . '">' . $node['text'] . '</a>';
                 } else {
                     $ret = $this->rptk_err_msg[abs($ret_json['status'])];
                 }
                 return array(htmlspecialchars_decode($ret), 'text');
                 break;
             case 'RippleOS_code':
                 $this->requestdata('textnum');
                 $node = D('Rippleos_node')->where(array('id' => $data['pid']))->find();
                 $ret_json = $this->rippleos_auth_token($node['node']);
                 if (is_array($node) && $ret_json['status'] === 0) {
                     $ret = '上网验证码:' . $ret_json['auth_token'] . '(验证码有效期为10分钟)';
                 } else {
                     $ret = $this->rptk_err_msg[abs($ret_json['status'])];
                 }
                 return array(htmlspecialchars_decode($ret), 'text');
                 break;
             case 'Host':
                 $this->requestdata('other');
                 $host = M('Host')->where(array('id' => $data['pid']))->find();
                 return array(array(array($host['name'], $host['info'], $host['ppicurl'], $this->siteUrl . '/index.php?g=Wap&m=Host&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&hid=' . $data['pid'] . '')), 'news');
                 break;
             case 'Estate':
                 $this->requestdata('other');
                 $Estate = M('Estate')->where(array('id' => $data['pid']))->find();
                 return array(array(array($Estate['title'], $Estate['estate_desc'], $Estate['cover'], $this->siteUrl . '/index.php?g=Wap&m=Estate&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . ''), array('楼盘介绍', $Estate['estate_desc'], $Estate['house_banner'], $this->siteUrl . '/index.php?g=Wap&m=Estate&a=index&&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&hid=' . $data['pid'] . ''), array('专家点评', $Estate['estate_desc'], $Estate['cover'], $this->siteUrl . '/index.php?g=Wap&m=Estate&a=impress&&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&hid=' . $data['pid'] . ''), array('楼盘3D全景', $Estate['estate_desc'], $Estate['banner'], $this->siteUrl . '/index.php?g=Wap&m=Panorama&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&hid=' . $data['pid'] . ''), array('楼盘动态', $Estate['estate_desc'], $Estate['house_banner'], $this->siteUrl . '/index.php?g=Wap&m=Index&a=lists&classid=' . $Estate['classify_id'] . '&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&hid=' . $data['pid'] . '')), 'news');
                 break;
             case 'Reservation':
                 $this->requestdata('other');
                 $rt = M('Reservation')->where(array('id' => $data['pid']))->find();
                 if (!strpos($rt['picurl'], 'ttp:')) {
                     $rt['picurl'] = $this->siteUrl . $rt['picurl'];
                 }
                 return array(array(array($rt['title'], $rt['info'], $rt['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Reservation&a=index&rid=' . $data['pid'] . '&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '')), 'news');
                 break;
             case 'Text':
                 $this->requestdata('textnum');
                 $info = M($data['module'])->order('id desc')->find($data['pid']);
                 return array(htmlspecialchars_decode(str_replace('{wechat_id}', $this->data['FromUserName'], $info['text'])), 'text');
                 break;
             case 'Product':
                 $this->requestdata('other');
                 $infos = M('Product')->limit(9)->order('id desc')->where($like)->select();
                 if ($infos) {
                     $return = array();
                     foreach ($infos as $info) {
                         if (!$info['groupon']) {
                             $url = $this->siteUrl . '/index.php?g=Wap&m=Store&a=product&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $info['id'];
                         } else {
                             $url = $this->siteUrl . '/index.php?g=Wap&m=Groupon&a=product&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $info['id'];
                         }
                         $return[] = array($info['name'], $this->handleIntro(strip_tags(htmlspecialchars_decode($info['intro']))), $info['logourl'], $url);
                     }
                 }
                 return array($return, 'news');
                 break;
             case 'Selfform':
                 $this->requestdata('other');
                 $pro = M('Selfform')->where(array('id' => $data['pid']))->find();
                 return array(array(array($pro['name'], strip_tags(htmlspecialchars_decode($pro['intro'])), $pro['logourl'], $this->siteUrl . '/index.php?g=Wap&m=Selfform&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . '')), 'news');
                 break;
             case 'Panorama':
                 $this->requestdata('other');
                 $pro = M('Panorama')->where(array('id' => $data['pid']))->find();
                 return array(array(array($pro['name'], strip_tags(htmlspecialchars_decode($pro['intro'])), $pro['frontpic'], $this->siteUrl . '/index.php?g=Wap&m=Panorama&a=item&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . '')), 'news');
                 break;
             case 'Custom':
                 $this->requestdata('other');
                 $pro = M('Custom_set')->where(array('set_id' => $data['pid']))->find();
                 return array(array(array($pro['title'], $this->handleIntro($pro['intro']), $pro['top_pic'], $this->siteUrl . '/index.php?g=Wap&m=Custom&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . '')), 'news');
                 break;
             case 'Wedding':
                 $this->requestdata('other');
                 $wedding = M('Wedding')->where(array('id' => $data['pid']))->find();
                 return array(array(array($wedding['title'], strip_tags(htmlspecialchars_decode($wedding['word'])), $wedding['coverurl'], $this->siteUrl . '/index.php?g=Wap&m=Wedding&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . ''), array('查看我的祝福', strip_tags(htmlspecialchars_decode($wedding['word'])), $wedding['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Wedding&a=check&type=1&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . ''), array('查看我的来宾', strip_tags(htmlspecialchars_decode($wedding['word'])), $wedding['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Wedding&a=check&type=2&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . '')), 'news');
                 break;
             case 'Vote':
                 $this->requestdata('other');
                 $Vote = M('Vote')->where(array('id' => $data['pid']))->order('id DESC')->find();
                 return array(array(array($Vote['title'], '', $Vote['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Vote&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . '')), 'news');
                 break;
             case 'Greeting_card':
                 $this->requestdata('other');
                 $Vote = M('Greeting_card')->where(array('id' => $data['pid']))->order('id DESC')->find();
                 return array(array(array($Vote['title'], $this->handleIntro($Vote['info']), $Vote['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Greeting_card&a=index&id=' . $data['pid'] . '')), 'news');
                 break;
             case 'Lottery':
                 $this->requestdata('other');
                 $info = M('Lottery')->find($data['pid']);
                 if ($info == false || $info['status'] == 3) {
                     return array('活动可能已经结束或者被删除了', 'text');
                 }
                 switch ($info['type']) {
                     case 1:
                         $model = 'Lottery';
                         break;
                     case 2:
                         $model = 'Guajiang';
                         break;
                     case 3:
                         $model = 'Coupon';
                         break;
                     case 4:
                         $model = 'LuckyFruit';
                         break;
                     case 5:
                         $model = 'GoldenEgg';
                         break;
                     case 7:
                         $model = 'AppleGame';
                         break;
                     case 8:
                         $model = 'Lovers';
                         break;
                 }
                 $id = $info['id'];
                 $type = $info['type'];
                 if ($info['status'] == 1) {
                     $picurl = $info['starpicurl'];
                     $title = $info['title'];
                     $id = $info['id'];
                     $info = $info['info'];
                 } else {
                     $picurl = $info['endpicurl'];
                     $title = $info['endtite'];
                     $info = $info['endinfo'];
                 }
                 $url = $this->siteUrl . U('Wap/' . $model . '/index', array('token' => $this->token, 'type' => $type, 'wecha_id' => $this->data['FromUserName'], 'id' => $id, 'type' => $type));
                 return array(array(array($title, $this->handleIntro($info), $picurl, $url)), 'news');
             case 'Carowner':
                 $this->requestdata('other');
                 $thisItem = M('Carowner')->where(array('id' => $data['pid']))->find();
                 return array(array(array($thisItem['title'], $this->handleIntro($thisItem['info']), $thisItem['head_url'], $this->siteUrl . '/index.php?g=Wap&m=Car&a=owner&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . '')), 'news');
                 break;
             case 'Carset':
                 $this->requestdata('other');
                 $thisItem = M('Carset')->where(array('id' => $data['pid']))->find();
                 $news = array();
                 array_push($news, array($thisItem['title'], '', $thisItem['head_url'], $thisItem['url'] ? $thisItem['url'] : $this->siteUrl . '/index.php?g=Wap&m=Car&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName']));
                 array_push($news, array($thisItem['title1'], '', $thisItem['head_url_1'], $thisItem['url1'] ? $thisItem['url1'] : $this->siteUrl . '/index.php?g=Wap&m=Car&a=brands&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName']));
                 array_push($news, array($thisItem['title2'], '', $thisItem['head_url_2'], $thisItem['url2'] ? $thisItem['url2'] : $this->siteUrl . '/index.php?g=Wap&m=Car&a=salers&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName']));
                 array_push($news, array($thisItem['title3'], '', $thisItem['head_url_3'], $thisItem['url3'] ? $thisItem['url3'] : $this->siteUrl . '/index.php?g=Wap&m=Car&a=CarReserveBook&addtype=drive&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName']));
                 array_push($news, array($thisItem['title4'], '', $thisItem['head_url_4'], $thisItem['url4'] ? $thisItem['url4'] : $this->siteUrl . '/index.php?g=Wap&m=Car&a=owner&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName']));
                 array_push($news, array($thisItem['title5'], '', $thisItem['head_url_5'], $thisItem['url5'] ? $thisItem['url5'] : $this->siteUrl . '/index.php?g=Wap&m=Car&a=tool&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName']));
                 array_push($news, array($thisItem['title6'], '', $thisItem['head_url_6'], $thisItem['url6'] ? $thisItem['url6'] : $this->siteUrl . '/index.php?g=Wap&m=Car&a=showcar&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName']));
                 return array($news, 'news');
                 break;
             case 'medicalSet':
                 $thisItem = M('Medical_set')->where(array('id' => $data['pid']))->find();
                 return array(array(array($thisItem['title'], $this->handleIntro($thisItem['info']), $thisItem['head_url'], $this->siteUrl . '/index.php?g=Wap&m=Medical&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'])), 'news');
                 break;
             case 'zhaopianwall':
                 $thisItem = M('pic_wall')->where(array('token' => $this->token, 'status' => 1))->order('id desc')->find();
                 if (!$thisItem) {
                     return array('图片上墙失败!还未开启照片墙功能。', 'text');
                 }
                 return array(array(array($thisItem['title'], $this->handleIntro($thisItem['info']), $thisItem['starpicurl'], $this->siteUrl . '/index.php?g=Wap&m=Zhaopianwall&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '')), 'news');
                 break;
             case 'Shake':
                 $thisItem = M('Shake')->where(array('id' => $data['pid']))->find();
                 $shakeRecord = M('Shake_rt')->where(array('shakeid' => $data['pid'], 'wecha_id' => $this->data['FromUserName']))->find();
                 if (!$shakeRecord) {
                     if ($this->fans['tel']) {
                         $shakeRtRow = array();
                         $shakeRtRow['token'] = $this->token;
                         $shakeRtRow['wecha_id'] = $this->data['FromUserName'];
                         $shakeRtRow['shakeid'] = $thisItem['id'];
                         $shakeRtRow['phone'] = htmlspecialchars($this->fans['tel']);
                         M('Shake_rt')->add($shakeRtRow);
                         return array(array(array($thisItem['title'], $thisItem['intro'] . '。您的电话为:' . $shakeRtRow['phone'] . ',如需修改请回复"shake+您的手机号"', $thisItem['thumb'], $this->siteUrl . '/index.php?g=Wap&m=Shake&a=index&id=' . $thisItem['id'] . '&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'])), 'news');
                     } else {
                         return array('请回复shake加您的手机号参与活动', 'text');
                     }
                 } else {
                     return array(array(array($thisItem['title'], $thisItem['intro'] . '。您的电话为:' . $this->fans['tel'] . ',如需修改请回复"shake+您的手机号"', $thisItem['thumb'], $this->siteUrl . '/index.php?g=Wap&m=Shake&a=index&id=' . $thisItem['id'] . '&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'])), 'news');
                 }
                 break;
             case 'Wall':
                 $thisItem = M('Wall')->where(array('id' => $data['pid']))->find();
                 if (!$thisItem['isopen']) {
                     return array('微信墙活动已关闭', 'text');
                 } else {
                     $memberRecord = M('Wall_member')->where(array('wallid' => $data['pid'], 'wecha_id' => $this->data['FromUserName']))->find();
                     if (!$memberRecord || !$this->fans) {
                         return array('<a href="' . $this->siteUrl . U('Wap/Userinfo/index', array('token' => $this->token, 'wecha_id' => $this->data['FromUserName'], 'redirect' => 'Wall/person|id:' . intval($data['pid']))) . '">请点击这里完善信息后再参加此活动</a>', 'text');
                     } else {
                         M('Userinfo')->where(array('token' => $this->token, 'wecha_id' => $this->data['FromUserName']))->save(array('wallopen' => 1));
                         S('fans_' . $this->token . '_' . $this->data['FromUserName'], NULL);
                         return array('您已进入微信墙对话模式,您下面发送的所有文字和图片信息都将会显示在大屏幕上,如需退出微信墙模式,请输入“wx#quit”', 'text');
                     }
                 }
                 break;
             case 'Recipe':
                 $this->requestdata('other');
                 $thisItem = M('Recipe')->where(array('id' => $data['pid']))->find();
                 return array(array(array($thisItem['title'], str_replace(array('&nbsp;', 'br /', '&amp;', 'gt;', 'lt;'), '', strip_tags(htmlspecialchars_decode($thisItem['infos']))), $thisItem['headpic'], $this->siteUrl . '/index.php?g=Wap&m=Recipe&a=index&token=' . $this->token . '&type=' . $thisItem['type'] . '&id=' . $thisItem['id'] . 'wecha_id=' . $this->data['FromUserName'])), 'news');
                 break;
             case 'Router_config':
                 $routerUrl = Router::login($this->token, $this->data['FromUserName']);
                 $thisItem = M('Router_config')->where(array('id' => $data['pid']))->find();
                 return array(array(array($thisItem['title'], $thisItem['info'], $thisItem['picurl'], $routerUrl)), 'news');
                 break;
             case 'Schoolset':
                 $thisItem = M('School_set_index')->where(array('setid' => $data['pid']))->find();
                 return array(array(array($thisItem['title'], $thisItem['info'], $thisItem['head_url'], $this->siteUrl . U('Wap/School/index', array('token' => $this->token, 'wecha_id' => $this->data['FromUserName'])))), 'news');
                 break;
             case 'Research':
                 $thisItem = M('Research')->where(array('id' => $data['pid']))->find();
                 return array(array(array($thisItem['title'], $thisItem['description'], $thisItem['logourl'], $this->siteUrl . U('Wap/Research/index', array('reid' => $data['pid'], 'token' => $this->token, 'wecha_id' => $this->data['FromUserName'])))), 'news');
                 break;
             case 'Business':
                 $this->requestdata('other');
                 $thisItem = M('Busines')->where(array('bid' => $data['pid']))->find();
                 return array(array(array($thisItem['title'], str_replace(array('&nbsp;', 'br /', '&amp;', 'gt;', 'lt;'), '', strip_tags(htmlspecialchars_decode($thisItem['business_desc']))), $thisItem['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Business&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&bid=' . $thisItem['bid'] . '&type=' . $thisItem['type'])), 'news');
                 break;
             case 'Sign':
                 $thisItem = M('Sign_set')->where(array('id' => $data['pid']))->find();
                 return array(array(array($thisItem['title'], $thisItem['content'], $thisItem['reply_img'], $this->siteUrl . U('Wap/Fanssign/index', array('token' => $this->token, 'wecha_id' => $this->data['FromUserName'])))), 'news');
                 break;
             case 'Multi':
                 $multiImgClass = new multiImgNews($this->token, $this->data['FromUserName'], $this->siteUrl);
                 return $multiImgClass->news($data['pid']);
                 break;
             case 'Market':
                 $thisItem = M('Market')->where(array('market_id' => $data['pid']))->find();
                 return array(array(array($thisItem['title'], $thisItem['address'], $thisItem['logo_pic'], $this->siteUrl . U('Wap/Market/index', array('token' => $this->token, 'wecha_id' => $this->data['FromUserName'])))), 'news');
             default:
                 $this->requestdata('videonum');
                 $info = M($data['module'])->order('id desc')->find($data['pid']);
                 return array(array($info['title'], $info['keyword'], $info['musicurl'], $info['hqmusicurl']), 'music');
         }
     } else {
         $nokeywordReply = $this->nokeywordApi();
         if ($nokeywordReply) {
             return $nokeywordReply;
         }
         if ($this->wxuser['transfer_customer_service']) {
             return array('turn on transfer_customer_service', 'transfer_customer_service');
         }
         $chaFfunction = M('Function')->where(array('funname' => 'liaotian'))->find();
         if (!strpos($this->fun, 'liaotian') || !$chaFfunction['status']) {
             $other = M('Other')->where(array('token' => $this->token))->find();
             if ($other == false) {
                 return array('请在平台里设置回答不上来的回复', 'text');
             } else {
                 if (empty($other['keyword'])) {
                     return array($other['info'], 'text');
                 } else {
                     $img = M('Img')->field('id,text,pic,url,title')->limit(10)->order('usort desc')->where(array('token' => $this->token, 'keyword' => array('like', '%' . $other['keyword'] . '%')))->select();
                     if ($img == false) {
                         $multiImgs = M('Img_multi')->where(array('token' => $this->token, 'keyword' => array('like', '%' . $other['keyword'] . '%')))->select();
                         if (!$multiImgs) {
                             return array('无此图文信息,请提醒商家,重新设定关键词', 'text');
                         } else {
                             $multiImgClass = new multiImgNews($this->token, $this->data['FromUserName'], $this->siteUrl);
                             return $multiImgClass->news($multiImgs['id']);
                         }
                     }
                     foreach ($img as $keya => $infot) {
                         if ($infot['url'] != false) {
                             if (!(strpos($infot['url'], 'http') === FALSE)) {
                                 $url = $this->getFuncLink(html_entity_decode($infot['url']));
                             } else {
                                 $url = $this->getFuncLink($infot['url']);
                             }
                         } else {
                             $url = rtrim($this->siteUrl, '/') . U('Wap/Index/content', array('token' => $this->token, 'id' => $infot['id'], 'wecha_id' => $this->data['FromUserName']));
                         }
                         $return[] = array($infot['title'], $infot['text'], $infot['pic'], $url);
                     }
                     return array($return, 'news');
                 }
             }
         }
         if (!C('not_support_chat')) {
             $this->selectService();
         }
         return array($this->chat($key), 'text');
     }
 }
Beispiel #3
0
	private function keyword($key)
	{
		$params = func_get_args();
		if (($params[1] != '') && ($this->token == '')) {
			$this->token = $params[1];
			$this->data = $params[2];
			$this->siteUrl = $params[3];
			$this->wxuser = D('Wxuser')->where(array('token' => $this->token))->find();
			$this->user = M('Users')->where(array('id' => $this->wxuser['uid']))->find();
		}

		$keyarray = explode('_', $key);
		$key = $keyarray[0];

		switch ($key) {
		case '首页':
		case 'home':
		case 'Home':
			return $this->home();
			break;

		case '主页':
			return $this->home();
			break;

		case '地图':
			return $this->companyMap();
		case '最近的':
			$this->recordLastRequest($key);
			$user_request_model = M('User_request');
			$loctionInfo = $user_request_model->where(array('token' => $this->token, 'msgtype' => 'location', 'uid' => $this->data['FromUserName']))->find();
			if ($loctionInfo && intval((time() - 60) < $loctionInfo['time'])) {
				$latLng = explode(',', $loctionInfo['keyword']);
				return $this->map($latLng[1], $latLng[0]);
			}

			return array('请发送您所在的位置(对话框右下角点击+号,然后点击“位置”)', 'text');
			break;

		case '帮助':
			return $this->help();
			break;

		case 'help':
			return $this->help();
			break;

		case '会员卡':
			return $this->member();
			break;

		case '会员':
			return $this->member();
			break;

		case '3g相册':
			return $this->xiangce();
			break;

		case '相册':
			return $this->xiangce();
			break;

		case '商城':
			$pro = M('reply_info')->where(array('infotype' => 'Shop', 'token' => $this->token))->find();
			$url = $this->siteUrl . '/index.php?g=Wap&m=Store&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '';

			if ($pro['apiurl']) {
				$url = str_replace('&amp;', '&', $pro['apiurl']);
			}

			return array(
	array(
		array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['picurl'], $url)
		),
	'news'
	);
			break;

		case '订餐':
			$pro = M('reply_info')->where(array('infotype' => 'Dining', 'token' => $this->token))->find();
			$url = $this->siteUrl . '/index.php?g=Wap&m=Repast&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '';

			if ($pro['apiurl']) {
				$url = str_replace('&amp;', '&', $pro['apiurl']);
			}

			return array(
	array(
		array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['picurl'], $url)
		),
	'news'
	);
			break;

		case '留言':
			$pro = M('reply_info')->where(array('infotype' => 'message', 'token' => $this->token))->find();

			if ($pro) {
				return array(
	array(
		array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Reply&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '')
		),
	'news'
	);
			}
			else {
				return array(
	array(
		array('留言板', '在线留言', rtrim($this->siteUrl, '/') . '/tpl/Wap/default/common/css/style/images/ly.jpg', $this->siteUrl . '/index.php?g=Wap&m=Reply&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '')
		),
	'news'
	);
			}

			break;

		case '酒店':
			$pro = M('reply_info')->where(array('infotype' => 'Hotels', 'token' => $this->token))->find();

			if ($pro) {
				return array(
	array(
		array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Hotels&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'])
		),
	'news'
	);
			}
			else {
				return array(
	array(
		array('酒店', '酒店在线预订', rtrim($this->siteUrl, '/') . 'tpl/static/images/homelogo.png', $this->siteUrl . '/index.php?g=Wap&m=Hotels&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'])
		),
	'news'
	);
			}

			break;

		case '团购':
			$pro = M('reply_info')->where(array('infotype' => 'Groupon', 'token' => $this->token))->find();
			$url = $this->siteUrl . '/index.php?g=Wap&m=Groupon&a=grouponIndex&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '';

			if ($pro['apiurl']) {
				$url = str_replace('&amp;', '&', $pro['apiurl']);
			}

			return array(
	array(
		array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['picurl'], $url)
		),
	'news'
	);
			break;

		case '全景':
			$pro = M('reply_info')->where(array('infotype' => 'panorama', 'token' => $this->token))->find();

			if ($pro) {
				return array(
	array(
		array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Panorama&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '')
		),
	'news'
	);
			}
			else {
				return array(
	array(
		array('360°全景看车看房', '通过该功能可以实现3D全景看车看房', rtrim($this->siteUrl, '/') . '/tpl/User/default/common/images/panorama/360view.jpg', $this->siteUrl . '/index.php?g=Wap&m=Panorama&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '')
		),
	'news'
	);
			}

			break;

		case '讨论社区':
		case '论坛':
			$fconfig = M('Forum_config')->where(array('token' => $this->token))->find();
			return array(
	array(
		array($fconfig['forumname'], str_replace('&nbsp;', '', strip_tags(htmlspecialchars_decode($fconfig['intro']))), $fconfig['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Forum&a=index&&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'])
		),
	'news'
	);
			break;

		case '微商圈':
			$thisItem = M('Market')->where(array('token' => $this->token))->find();
			return array(
	array(
		array($thisItem['title'], $thisItem['address'], $thisItem['logo_pic'], $this->siteUrl . U('Wap/Market/index', array('token' => $this->token, 'wecha_id' => $this->data['FromUserName'])))
		),
	'news'
	);
			break;
		case '微招聘':
				$pro = M ( 'zhaopin_reply' )->where ( array (
						'token' => $this->token 
				) )->find ();
				if ($pro) {
					return array (
							array (
									array (
											$pro ['title'],
											strip_tags ( htmlspecialchars_decode ( $pro ['info'] ) ),
											$pro ['tp'],
											$this->siteUrl . U ( 'Wap/Zhaopin/index', array (
													'token' => $this->token,
													'wecha_id' => $this->data ['FromUserName'],
													'sgssz' => 'mp.weixin.qq.com' 
											) ) 
									),
									array (
											'【找简历】找简历,看这里',
											strip_tags ( htmlspecialchars_decode ( $pro ['info'] ) ),
											$this->siteUrl . '/tpl/Wap/default/common/zhaopin/jianli.png',
											$this->siteUrl . U ( 'Wap/Zhaopin/jlindex', array (
													'token' => $this->token,
													'wecha_id' => $this->data ['FromUserName'],
													'sgssz' => 'mp.weixin.qq.com' 
											) ) 
									),
									array (
											'【企业版】我要发布招聘',
											strip_tags ( htmlspecialchars_decode ( $pro ['info'] ) ),
											$this->siteUrl . '/tpl/Wap/default/common/zhaopin/qiye.png',
											$this->siteUrl . U ( 'Wap/Zhaopin/qiye', array (
													'token' => $this->token,
													'wecha_id' => $this->data ['FromUserName'],
													'sgssz' => 'mp.weixin.qq.com' 
											) ) 
									),
									array (
											'【个人版】我要发布简历',
											strip_tags ( htmlspecialchars_decode ( $pro ['info'] ) ),
											$this->siteUrl . '/tpl/Wap/default/common/zhaopin/geren.png',
											$this->siteUrl . U ( 'Wap/Zhaopin/geren', array (
													'token' => $this->token,
													'wecha_id' => $this->data ['FromUserName'],
													'sgssz' => 'mp.weixin.qq.com' 
											) ) 
									) 
							),
							'news' 
					);
				} else {
					return array (
							'该公众号暂未配置微招聘信息',
							'text' 
					);
				}
				break;
		}

		$check = $this->user('diynum', $key);

		if ($check['diynum'] != 1) {
			return array(C('connectout'), 'text');
		}

		$like['keyword'] = $key;
		$like['precisions'] = 1;
		$like['token'] = $this->token;
		$data = M('keyword')->where($like)->order('id desc')->find();

		if (!$data) {
			$like['keyword'] = array('like', '%' . $key . '%');
			$like['precisions'] = 0;
			$data = M('keyword')->where($like)->order('id desc')->find();
		}

		if ($data != false) {
			$this->behaviordata($data['module'], $data['pid']);
			$replyClassName = $data['module'] . 'Reply';

			if (class_exists($replyClassName)) {
				$replyClass = new $replyClassName($this->token, $this->data['FromUserName'], $data, $this->siteUrl, $key);
				return $replyClass->index();
			}
			else {
				switch ($data['module']) {
				case 'Img':
					$this->requestdata('imgnum');
					$img_db = M($data['module']);
					$back = $img_db->field('id,text,pic,url,title')->limit(9)->order('usort desc')->where($like)->select();
					$idsWhere = 'id in (';
					$comma = '';

					foreach ($back as $keya => $infot) {
						$idsWhere .= $comma . $infot['id'];
						$comma = ',';

						if ($infot['url'] != false) {
							if (!(strpos($infot['url'], 'http') === false)) {
								$url = $this->getFuncLink(html_entity_decode($infot['url']));
							}
							else {
								$url = $this->getFuncLink($infot['url']);
							}
						}
						else {
							$url = rtrim($this->siteUrl, '/') . U('Wap/Index/content', array('token' => $this->token, 'id' => $infot['id'], 'wecha_id' => $this->data['FromUserName']));
						}

						$return[] = array($infot['title'], $this->handleIntro($infot['text']), $infot['pic'], $url);
					}

					$idsWhere .= ')';

					if ($back) {
						$img_db->where($idsWhere)->setInc('click');
					}

					return array($return, 'news');
					break;

				case 'Host':
					$this->requestdata('other');
					$host = M('Host')->where(array('id' => $data['pid']))->find();
					return array(
	array(
		array($host['name'], $host['info'], $host['ppicurl'], $this->siteUrl . '/index.php?g=Wap&m=Host&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&hid=' . $data['pid'] . '')
		),
	'news'
	);
					break;

				case 'Reservation':
					$this->requestdata('other');
					$rt = M('Reservation')->where(array('id' => $data['pid']))->find();

					if (!strpos($rt['picurl'], 'ttp:')) {
						$rt['picurl'] = $this->siteUrl . $rt['picurl'];
					}

					return array(
	array(
		array($rt['title'], str_replace(array('&nbsp;', 'br /', '&amp;', 'gt;', 'lt;'), '', strip_tags(htmlspecialchars_decode($rt['info']))), $rt['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Reservation&a=index&rid=' . $data['pid'] . '&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '')
		),
	'news'
	);
					break;

				case 'Text':
					$this->requestdata('textnum');
					$info = M($data['module'])->order('id desc')->find($data['pid']);
					return array(htmlspecialchars_decode(str_replace('{wechat_id}', $this->data['FromUserName'], $info['text'])), 'text');
					break;

				case 'Product':
					$this->requestdata('other');
					$infos = M('Product')->limit(9)->order('id desc')->where($like)->select();

					if ($infos) {
						$return = array();

						foreach ($infos as $info) {
							if (!$info['groupon']) {
								$url = $this->siteUrl . '/index.php?g=Wap&m=Store&a=product&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $info['id'];
							}
							else {
								$url = $this->siteUrl . '/index.php?g=Wap&m=Groupon&a=product&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $info['id'];
							}

							$return[] = array($info['name'], $this->handleIntro(strip_tags(htmlspecialchars_decode($info['intro']))), $info['logourl'], $url);
						}
					}

					return array($return, 'news');
					break;

				case 'Selfform':
					$this->requestdata('other');
					$pro = M('Selfform')->where(array('id' => $data['pid']))->find();
					return array(
	array(
		array($pro['name'], strip_tags(htmlspecialchars_decode($pro['intro'])), $pro['logourl'], $this->siteUrl . '/index.php?g=Wap&m=Selfform&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . '')
		),
	'news'
	);
					break;

				case 'Custom':
					$this->requestdata('other');
					$pro = M('Custom_set')->where(array('set_id' => $data['pid']))->find();
					return array(
	array(
		array($pro['title'], strip_tags(htmlspecialchars_decode($pro['intro'])), $pro['top_pic'], $this->siteUrl . '/index.php?g=Wap&m=Custom&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . '')
		),
	'news'
	);
					break;

				case 'Panorama':
					$this->requestdata('other');
					$pro = M('Panorama')->where(array('id' => $data['pid']))->find();
					return array(
	array(
		array($pro['name'], strip_tags(htmlspecialchars_decode($pro['intro'])), $pro['frontpic'], $this->siteUrl . '/index.php?g=Wap&m=Panorama&a=item&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . '')
		),
	'news'
	);
					break;

				case 'Wedding':
					$this->requestdata('other');
					$wedding = M('Wedding')->where(array('id' => $data['pid']))->find();
					return array(
	array(
		array($wedding['title'], strip_tags(htmlspecialchars_decode($wedding['word'])), $wedding['coverurl'], $this->siteUrl . '/index.php?g=Wap&m=Wedding&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . ''),
		array('查看我的祝福', strip_tags(htmlspecialchars_decode($wedding['word'])), $wedding['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Wedding&a=check&type=1&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . ''),
		array('查看我的来宾', strip_tags(htmlspecialchars_decode($wedding['word'])), $wedding['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Wedding&a=check&type=2&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . '')
		),
	'news'
	);
					break;

				case 'Vote':
					$this->requestdata('other');
					$Vote = M('Vote')->where(array('id' => $data['pid']))->order('id DESC')->find();
					return array(
	array(
		array($Vote['title'], '', $Vote['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Vote&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . '')
		),
	'news'
	);
					break;

				case 'Greeting_card':
					$this->requestdata('other');
					$Vote = M('Greeting_card')->where(array('id' => $data['pid']))->order('id DESC')->find();
					return array(
	array(
		array($Vote['title'], str_replace(array('&nbsp;', 'br /', '&amp;', 'gt;', 'lt;'), '', strip_tags(htmlspecialchars_decode($Vote['info']))), $Vote['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Greeting_card&a=index&id=' . $data['pid'] . '')
		),
	'news'
	);
					break;

				case 'Lottery':
					$this->requestdata('other');
					$info = M('Lottery')->find($data['pid']);
					if (($info == false) || ($info['status'] == 3)) {
						return array('活动可能已经结束或者被删除了', 'text');
					}

					switch ($info['type']) {
					case 1:
						$model = 'Lottery';
						break;

					case 2:
						$model = 'Guajiang';
						break;

					case 3:
						$model = 'Coupon';
						break;

					case 4:
						$model = 'LuckyFruit';
						break;

					case 5:
						$model = 'GoldenEgg';
						break;

					case 7:
						$model = 'AppleGame';
						break;

					case 8:
						$model = 'Lovers';
						break;

					case 9:
						$model = 'Autumn';
						break;

					case 10:
						$model = 'Jiugong';
						break;
					}

					$id = $info['id'];
					$type = $info['type'];

					if ($info['status'] == 1) {
						$picurl = $info['starpicurl'];
						$title = $info['title'];
						$id = $info['id'];
						$info = $info['info'];
					}
					else {
						$picurl = $info['endpicurl'];
						$title = $info['endtite'];
						$info = $info['endinfo'];
					}

					$url = $this->siteUrl . U('Wap/' . $model . '/index', array('token' => $this->token, 'type' => $type, 'wecha_id' => $this->data['FromUserName'], 'id' => $id, 'type' => $type));
					return array(
	array(
		array($title, $info, $picurl, $url)
		),
	'news'
	);
				case 'Carowner':
					$this->requestdata('other');
					$thisItem = M('Carowner')->where(array('id' => $data['pid']))->find();
					return array(
	array(
		array($thisItem['title'], str_replace(array('&nbsp;', 'br /', '&amp;', 'gt;', 'lt;'), '', strip_tags(htmlspecialchars_decode($thisItem['info']))), $thisItem['head_url'], $this->siteUrl . '/index.php?g=Wap&m=Car&a=owner&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . '')
		),
	'news'
	);
					break;

				case 'Carowner':
					$this->requestdata('other');
					$thisItem = M('Carowner')->where(array('id' => $data['pid']))->find();
					return array(
	array(
		array($thisItem['title'], str_replace(array('&nbsp;', 'br /', '&amp;', 'gt;', 'lt;'), '', strip_tags(htmlspecialchars_decode($thisItem['info']))), $thisItem['head_url'], $this->siteUrl . '/index.php?g=Wap&m=Car&a=owner&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'])
		),
	'news'
	);
					break;

				case 'Carset':
					$this->requestdata('other');
					$thisItem = M('Carset')->where(array('id' => $data['pid']))->find();
					$news = array();
					array_push($news, array($thisItem['title'], '', $thisItem['head_url'], $thisItem['url'] ? $thisItem['url'] : $this->siteUrl . '/index.php?g=Wap&m=Car&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName']));
					array_push($news, array($thisItem['title1'], '', $thisItem['head_url_1'], $thisItem['url1'] ? $thisItem['url1'] : $this->siteUrl . '/index.php?g=Wap&m=Car&a=brands&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName']));
					array_push($news, array($thisItem['title2'], '', $thisItem['head_url_2'], $thisItem['url2'] ? $thisItem['url2'] : $this->siteUrl . '/index.php?g=Wap&m=Car&a=salers&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName']));
					array_push($news, array($thisItem['title3'], '', $thisItem['head_url_3'], $thisItem['url3'] ? $thisItem['url3'] : $this->siteUrl . '/index.php?g=Wap&m=Car&a=CarReserveBook&addtype=drive&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName']));
					array_push($news, array($thisItem['title4'], '', $thisItem['head_url_4'], $thisItem['url4'] ? $thisItem['url4'] : $this->siteUrl . '/index.php?g=Wap&m=Car&a=owner&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName']));
					array_push($news, array($thisItem['title5'], '', $thisItem['head_url_5'], $thisItem['url5'] ? $thisItem['url5'] : $this->siteUrl . '/index.php?g=Wap&m=Car&a=tool&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName']));
					array_push($news, array($thisItem['title6'], '', $thisItem['head_url_6'], $thisItem['url6'] ? $thisItem['url6'] : $this->siteUrl . '/index.php?g=Wap&m=Car&a=showcar&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName']));
					return array($news, 'news');
					break;

				case 'medicalSet':
					$this->requestdata('other');
					$thisItem = M('Medical_set')->where(array('id' => $data['pid']))->find();
					return array(
	array(
		array($thisItem['title'], str_replace(array('&nbsp;', 'br /', '&amp;', 'gt;', 'lt;'), '', strip_tags(htmlspecialchars_decode($thisItem['info']))), $thisItem['head_url'], $this->siteUrl . '/index.php?g=Wap&m=Medical&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'])
		),
	'news'
	);
					break;

				case 'Wall':
				case 'Scene':
					if ($data['module'] == 'Wall') {
						$act_model = M('Wall');
					}
					else {
						$act_model = M('Wechat_scene');
					}

					$thisItem = $act_model->where(array('id' => $data['pid']))->find();

					if ($data['module'] == 'Wall') {
						$acttype = 1;
						$isopen = $thisItem['isopen'];
						$picLogo = $thisItem['startbackground'];
					}
					else {
						$acttype = 3;
						$isopen = $thisItem['is_open'];
						$picLogo = $thisItem['pic'];
					}

					$str = $this->wallStr($acttype, $thisItem);

					if (!$isopen) {
						return array($thisItem['title'] . '活动已关闭', 'text');
					}
					else {
						$actid = $data['pid'];
						$memberRecord = M('Wall_member')->where(array('act_id' => $actid, 'act_type' => $acttype, 'wecha_id' => $this->data['FromUserName']))->find();

						if (!$memberRecord) {
							return array(
	array(
		array($thisItem['title'], '请点击这里完善信息后再参加此活动', $picLogo, $this->siteUrl . U('Wap/Scene_member/index', array('token' => $this->token, 'wecha_id' => $this->data['FromUserName'], 'act_type' => $acttype, 'id' => $actid, 'name' => 'wall')))
		),
	'news'
	);
						}
						else {
							D('Userinfo')->where(array('token' => $this->token, 'wecha_id' => $this->data['FromUserName']))->save(array('wallopen' => 1));
							S('fans_' . $this->token . '_' . $this->data['FromUserName'], NULL);
							return array($str, 'text');
						}
					}

					break;

				case 'Recipe':
					$this->requestdata('other');
					$thisItem = M('Recipe')->where(array('id' => $data['pid']))->find();
					return array(
	array(
		array($thisItem['title'], str_replace(array('&nbsp;', 'br /', '&amp;', 'gt;', 'lt;'), '', strip_tags(htmlspecialchars_decode($thisItem['infos']))), $thisItem['headpic'], $this->siteUrl . '/index.php?g=Wap&m=Recipe&a=index&token=' . $this->token . '&type=' . $thisItem['type'] . '&id=' . $thisItem['id'] . 'wecha_id=' . $this->data['FromUserName'])
		),
	'news'
	);
					break;

				case 'Router_config':
					$routerUrl = Router::login($this->token, $this->data['FromUserName']);
					$thisItem = M('Router_config')->where(array('id' => $data['pid']))->find();
					return array(
	array(
		array($thisItem['title'], $thisItem['info'], $thisItem['picurl'], $routerUrl)
		),
	'news'
	);
					break;

				case 'Schoolset':
					$thisItem = M('School_set_index')->where(array('setid' => $data['pid']))->find();
					return array(
	array(
		array($thisItem['title'], $thisItem['info'], $thisItem['head_url'], $this->siteUrl . U('Wap/School/index', array('token' => $this->token, 'wecha_id' => $this->data['FromUserName'])))
		),
	'news'
	);
					break;

				case 'Research':
					$thisItem = M('Research')->where(array('id' => $data['pid']))->find();
					return array(
	array(
		array($thisItem['title'], $thisItem['description'], $thisItem['logourl'], $this->siteUrl . U('Wap/Research/index', array('reid' => $data['pid'], 'token' => $this->token, 'wecha_id' => $this->data['FromUserName'])))
		),
	'news'
	);
					break;

				case 'Business':
					$this->requestdata('other');
					$thisItem = M('Busines')->where(array('bid' => $data['pid']))->find();
					return array(
	array(
		array($thisItem['title'], str_replace(array('&nbsp;', 'br /', '&amp;', 'gt;', 'lt;'), '', strip_tags(htmlspecialchars_decode($thisItem['business_desc']))), $thisItem['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Business&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&bid=' . $thisItem['bid'] . '&type=' . $thisItem['type'])
		),
	'news'
	);
					break;

				case 'Sign':
					$thisItem = M('Sign_set')->where(array('id' => $data['pid']))->find();
					return array(
	array(
		array($thisItem['title'], $thisItem['content'], $thisItem['reply_img'], $this->siteUrl . U('Wap/Fanssign/index', array('token' => $this->token, 'wecha_id' => $this->data['FromUserName'], 'id' => $data['pid'])))
		),
	'news'
	);
					break;

				case 'Multi':
					$multiImgClass = new multiImgNews($this->token, $this->data['FromUserName'], $this->siteUrl);
					return $multiImgClass->news($data['pid']);
					break;

				case 'Market':
					$thisItem = M('Market')->where(array('market_id' => $data['pid']))->find();
					return array(
	array(
		array($thisItem['title'], $thisItem['address'], $thisItem['logo_pic'], $this->siteUrl . U('Wap/Market/index', array('token' => $this->token, 'wecha_id' => $this->data['FromUserName'])))
		),
	'news'
	);
				default:
					$replyClassName = $data['module'] . 'Reply';

					if (class_exists($replyClassName)) {
						$replyClass = new $replyClassName($this->token, $this->data['FromUserName'], $data, $this->siteUrl);
						return $replyClass->index();
					}
					else {
						$this->requestdata('videonum');
						$info = M($data['module'])->order('id desc')->find($data['pid']);
						return array(
	array($info['title'], $info['keyword'], $info['musicurl'], $info['hqmusicurl']),
	'music'
	);
					}
				}
			}
		}
		else {
			$nokeywordReply = $this->nokeywordApi();

			if ($nokeywordReply) {
				return $nokeywordReply;
			}

			if ($this->wxuser['transfer_customer_service']) {
				return array('turn on transfer_customer_service', 'transfer_customer_service');
			}

			$chaFfunction = M('Function')->where(array('funname' => 'liaotian'))->find();
			if ((strpos($this->fun, 'liaotian') === false) || !$chaFfunction['status']) {
				if ($keyarray[1] == 'noreplyReturn') {
					return array('要不要这么难,这个我回答不上来。%>_<%', 'text');
					exit();
				}
				else {
					return $this->noreplyReturn();
				}
			}

			if (!C('not_support_chat')) {
				$this->selectService();
			}

			return array($this->chat($key), 'text');
		}
	}
    private function keyword($key)
    {
        $key = trim($key);
        $like['keyword'] = array('like', ('%' . $key) . '%');
        $like['token'] = $this->token;
        $data = M('keyword')->where($like)->order('id desc')->find();
        if ($data != false) {
            $this->behaviordata($data['module'], $data['pid']);
            switch ($data['module']) {
            case 'Img':
                $this->requestdata('imgnum');
                $img_db = M($data['module']);
                //修改以sort来排序
                $like['pic'] = array('neq', '');
                $back = $img_db->field('id,text,pic,url,title')->limit(9)->order('usort desc,id DESC')->where($like)->select();
                if ($back == false) {
                    return array(('‘' . $data['keyword']) . '’无此图文信息或图片,请提醒商家,重新设定关键词', 'text');
                }
                $idsWhere = 'id in (';
                $comma = '';
                foreach ($back as $keya => $infot) {
                    $idsWhere .= $comma . $infot['id'];
                    $comma = ',';
                    if ($infot['url'] != false) {
                        if (!(strpos($infot['url'], 'http') === FALSE)) {
                            $url = $this->getFuncLink(html_entity_decode($infot['url']));
                        } else {
                            $url = $this->getFuncLink($infot['url']);
                        }
                    } else {
                        $url = rtrim(C('site_url'), '/') . U('Wap/Index/content', array('token' => $this->token, 'id' => $infot['id'], 'wecha_id' => $this->data['FromUserName']));
                    }
                    $return[] = array($infot['title'], $this->handleIntro($infot['text']), $infot['pic'], $url);
                }
                $idsWhere .= ')';
                if ($back) {
                    $img_db->where($idsWhere)->setInc('click');
                }
                return array($return, 'news');
                break;
				
				case 'RippleOS_url':
			        $this->requestdata('textnum');
			        $node=D('Rippleos_node')->where(array('id'=>$data['pid']))->find();
			        $ret_json = $this->rippleos_auth_url($node['node']);
			        if (is_array($node) && ($ret_json['status'] === 0))
			        {
			        	$ret = '<a href="'.$ret_json['auth_url'].'">'.$node['text'].'</a>';
			        }
			        else
			        {
			        	$ret = $this->rptk_err_msg[abs($ret_json['status'])];
			        }					
					return array(htmlspecialchars_decode($ret),'text');
			    break;
			    case 'RippleOS_code':
			        $this->requestdata('textnum');
			        $node=D('Rippleos_node')->where(array('id'=>$data['pid']))->find();
			        $ret_json = $this->rippleos_auth_token($node['node']);
			        if (is_array($node) && ($ret_json['status'] === 0))
			        {
			        	$ret = '上网验证码:'.$ret_json['auth_token'].'(验证码有效期为10分钟)';
			        }
			        else
			        {
			        	$ret = $this->rptk_err_msg[abs($ret_json['status'])];
			        }					
					return array(htmlspecialchars_decode($ret),'text');
			    break;
				
				
            case 'Host':
                $this->requestdata('other');
                $host = M('Host')->where(array('id' => $data['pid']))->find();
                return array(array(array($host['name'], $this->handleIntro($host['info']), $host['ppicurl'], ((((((C('site_url') . '/index.php?g=Wap&m=Host&a=index&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName']) . '&hid=') . $data['pid']) . '&sgssz=mp.weixin.qq.com')), 'news');
                break;
            case 'Goldegg':
                $this->requestdata('other');
                $info = M('Goldegg')->find($data['pid']);
                if ($info == false || $info['status'] == 2) {
                    return array('活动可能已经结束或者被删除了', 'text');
                }
                if ($info['status'] == 0) {
                    return array(('活动还未开始,请' . date('Y-m-d', $info['startdate'])) . '再来或者联系工作人员', 'text');
                }
                $id = $info['id'];
                if ($info['status'] == 1) {
                    $picurl = $info['startpicurl'];
                    $title = $info['title'];
                    $id = $info['id'];
                    $info = $info['info'];
                } else {
                    $picurl = $info['endpicurl'];
                    $title = $info['endtite'];
                    $info = $info['endinfo'];
                }
                $url = C('site_url') . U('Wap/Goldegg/index', array('token' => $this->token, 'wecha_id' => $this->data['FromUserName'], 'id' => $id, 'type' => $type));
                M('Goldegg')->where($id)->setInc('click');
                return array(array(array($title, $this->handleIntro($info), $picurl, $url . '#wx.asjhwl.com')), 'news');
                break;
            case 'Estate':
                $this->requestdata('other');
                $Estate = M('Estate')->where(array('id' => $data['pid']))->find();
                return array(array(array($Estate['title'], $this->handleIntro($Estate['estate_desc']), $Estate['cover'], ((((C('site_url') . '/index.php?g=Wap&m=Estate&a=index&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName']) . '&sgssz=mp.weixin.qq.com'), array('楼盘介绍', $this->handleIntro($Estate['estate_desc']), $Estate['house_banner'], ((((((C('site_url') . '/index.php?g=Wap&m=Estate&a=index&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName']) . '&hid=') . $data['pid']) . '&sgssz=mp.weixin.qq.com'), array('专家点评', $this->handleIntro($Estate['estate_desc']), $Estate['cover'], ((((((C('site_url') . '/index.php?g=Wap&m=Estate&a=impress&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName']) . '&hid=') . $data['pid']) . '&sgssz=mp.weixin.qq.com'), array('楼盘3D全景', $this->handleIntro($Estate['estate_desc']), $Estate['banner'], ((((((C('site_url') . '/index.php?g=Wap&m=Panorama&a=index&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName']) . '&hid=') . $data['pid']) . '&sgssz=mp.weixin.qq.com'), array('楼盘动态', $this->handleIntro($Estate['estate_desc']), $Estate['house_banner'], ((((((((C('site_url') . '/index.php?g=Wap&m=Index&a=lists&classid=') . $Estate['classify_id']) . '&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName']) . '&hid=') . $data['pid']) . '&sgssz=mp.weixin.qq.com')), 'news');
                break;
            case 'Reservation':
                $this->requestdata('other');
                $rt = M('Reservation')->where(array('id' => $data['pid']))->find();
                return array(array(array($rt['title'], $this->handleIntro($rt['info']), $rt['picurl'], ((((((C('site_url') . '/index.php?g=Wap&m=Reservation&a=index&rid=') . $data['pid']) . '&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName']) . '&sgssz=mp.weixin.qq.com')), 'news');
                break;
            case 'Text':
                $this->requestdata('textnum');
                $info = M($data['module'])->order('id desc')->find($data['pid']);
                return array(htmlspecialchars_decode(str_replace('{wechat_id}', $this->data['FromUserName'], $info['text'])), 'text');
                break;
            case 'Medical':
                $this->requestdata('other');
                $pro = M('Medical')->where(array('id' => $data['pid']))->find();
                return array(array(array($pro['title'], $this->handleIntro($pro['content']), $pro['piccover'], (((((C('site_url') . '/index.php?g=Wap&m=Medical&a=index&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName']) . '&id=') . $data['pid'])), 'news');
                break;
            case 'medicalSet':
                $thisItem = M('Medical_set')->where(array('id' => $data['pid']))->find();
                return array(array(array($thisItem['title'], str_replace(array('&nbsp;', 'br /', '&amp;', 'gt;', 'lt;'), '', $this->handleIntro($thisItem['info'])), $thisItem['head_url'], (((C('site_url') . '/index.php?g=Wap&m=Medical&a=index&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName'])), 'news');
                break;
            case 'Shipin':
                $this->requestdata('other');
                $pro = M('Shipin')->where(array('id' => $data['pid']))->find();
                return array(array(array($pro['title'], $this->handleIntro($pro['content']), $pro['picurl'], (((((C('site_url') . '/index.php?g=Wap&m=Shipin&a=index&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName']) . '&id=') . $data['pid'])), 'news');
                break;
            case 'Diaoyan':
                $this->requestdata('other');
                $pro = M('Diaoyan')->where(array('id' => $data['pid']))->find();
                return array(array(array($pro['title'], $this->handleIntro($pro['sinfo']), $pro['pic'], (((((C('site_url') . '/index.php?g=Wap&m=Diaoyan&a=index&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName']) . '&id=') . $data['pid'])), 'news');
                break;
            case 'Jiaoyu':
                $this->requestdata('other');
                $pro = M('Jiaoyu')->where(array('id' => $data['pid']))->find();
                return array(array(array($pro['title'], $this->handleIntro($pro['content']), $pro['picurl'], (((((C('site_url') . '/index.php?g=Wap&m=Jiaoyu&a=index&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName']) . '&id=') . $data['pid'])), 'news');
                break;
            case 'Invites':
                $this->requestdata('other');
                $info = M('Invites')->where(array('id' => $data['pid']))->find();
                if ($info == false) {
                    return array('商家未做邀请回复配置,请稍后再试', 'text');
                }
                return array(array(array($info['title'], $this->handleIntro($info['brief']), $info['picurl'], C('site_url') . U('Wap/Invites/index', array('token' => $this->token, 'id' => $info['id'])))), 'news');
                break;
            case 'Lvyou':
                $this->requestdata('other');
                $pro = M('Lvyou')->where(array('id' => $data['pid']))->find();
                return array(array(array($pro['title'], $this->handleIntro($pro['content']), $pro['picurl'], (((((C('site_url') . '/index.php?g=Wap&m=Lvyou&a=index&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName']) . '&id=') . $data['pid'])), 'news');
                break;
            case 'Huadian':
                $this->requestdata('other');
                $pro = M('Huadian')->where(array('id' => $data['pid']))->find();
                return array(array(array($pro['title'], $this->handleIntro($pro['content']), $pro['picurl'], (((((C('site_url') . '/index.php?g=Wap&m=Huadian&a=index&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName']) . '&id=') . $data['pid'])), 'news');
                break;
            case 'Wuye':
                $this->requestdata('other');
                $pro = M('Wuye')->where(array('id' => $data['pid']))->find();
                return array(array(array($pro['title'], $this->handleIntro($pro['content']), $pro['picurl'], (((((C('site_url') . '/index.php?g=Wap&m=Wuye&a=index&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName']) . '&id=') . $data['pid'])), 'news');
                break;
            case 'Jiuba':
                $this->requestdata('other');
                $pro = M('Jiuba')->where(array('id' => $data['pid']))->find();
                return array(array(array($pro['title'], $this->handleIntro($pro['content']), $pro['picurl'], (((((C('site_url') . '/index.php?g=Wap&m=Jiuba&a=index&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName']) . '&id=') . $data['pid'])), 'news');
                break;
            case 'Hunqing':
                $this->requestdata('other');
                $pro = M('Hunqing')->where(array('id' => $data['pid']))->find();
                return array(array(array($pro['title'], $this->handleIntro($pro['content']), $pro['picurl'], (((((C('site_url') . '/index.php?g=Wap&m=Hunqing&a=index&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName']) . '&id=') . $data['pid'])), 'news');
                break;
            case 'Zhuangxiu':
                $this->requestdata('other');
                $pro = M('Zhuangxiu')->where(array('id' => $data['pid']))->find();
                return array(array(array($pro['title'], $this->handleIntro($pro['content']), $pro['picurl'], (((((C('site_url') . '/index.php?g=Wap&m=Zhuangxiu&a=index&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName']) . '&id=') . $data['pid'])), 'news');
                break;
            case 'Ktv':
                $this->requestdata('other');
                $pro = M('Ktv')->where(array('id' => $data['pid']))->find();
                return array(array(array($pro['title'], $this->handleIntro($pro['content']), $pro['picurl'], (((((C('site_url') . '/index.php?g=Wap&m=Ktv&a=index&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName']) . '&id=') . $data['pid'])), 'news');
                break;
            case 'Jianshen':
                $this->requestdata('other');
                $pro = M('Jianshen')->where(array('id' => $data['pid']))->find();
                return array(array(array($pro['title'], $this->handleIntro($pro['content']), $pro['picurl'], (((((C('site_url') . '/index.php?g=Wap&m=Jianshen&a=index&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName']) . '&id=') . $data['pid'])), 'news');
                break;
            case 'Zhengwu':
                $this->requestdata('other');
                $pro = M('Zhengwu')->where(array('id' => $data['pid']))->find();
                return array(array(array($pro['title'], $this->handleIntro($pro['content']), $pro['picurl'], (((((C('site_url') . '/index.php?g=Wap&m=Zhengwu&a=index&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName']) . '&id=') . $data['pid'])), 'news');
                break;
            case 'Cosmetology':
                $this->requestdata('other');
                $pro = M('Cosmetology')->where(array('id' => $data['pid']))->find();
                return array(array(array($pro['title'], $this->handleIntro($pro['content']), $pro['piccover'], (((((C('site_url') . '/index.php?g=Wap&m=Cosmetology&a=index&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName']) . '&id=') . $data['pid'])), 'news');
                break;
            case 'Product':
                $this->requestdata('other');
                $infos = M('Product')->limit(9)->order('id desc')->where($like)->select();
                if ($infos) {
                    $return = array();
                    foreach ($infos as $info) {
                        if (!$info['groupon']) {
                            $url = (((((C('site_url') . '/index.php?g=Wap&m=Store&a=product&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName']) . '&id=') . $info['id'];
                        } else {
                            $url = (((((C('site_url') . '/index.php?g=Wap&m=Groupon&a=product&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName']) . '&id=') . $info['id'];
                        }
                        $return[] = array($info['name'], $this->handleIntro(strip_tags(htmlspecialchars_decode($info['intro']))), $info['logourl'], $url);
                    }
                }
                return array($return, 'news');
                break;
            case 'Selfform':
                $this->requestdata('other');
                $pro = M('Selfform')->where(array('id' => $data['pid']))->find();
                return array(array(array($pro['name'], $this->handleIntro($pro['intro']), $pro['logourl'], ((((((C('site_url') . '/index.php?g=Wap&m=Selfform&a=index&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName']) . '&id=') . $data['pid']) . '&sgssz=mp.weixin.qq.com')), 'news');
                break;
            case 'Panorama':
                $this->requestdata('other');
                $pro = M('Panorama')->where(array('id' => $data['pid']))->find();
                return array(array(array($pro['title'], $this->handleIntro($pro['intro']), C('site_url') . $pro['picurl'], ((((((C('site_url') . '/index.php?g=Wap&m=Panorama&a=item&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName']) . '&id=') . $data['pid']) . '&sgssz=mp.weixin.qq.com')), 'news');
                break;
			case 'Custom':
                $this->requestdata('other');
                $pro = M('Custom_set')->where(array('set_id' => $data['pid']))->find();
                return array(array(array($pro['title'], $this->handleIntro($pro['intro']), $pro['top_pic'], (((((($this->siteUrl . '/index.php?g=Wap&m=Custom&a=index&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName']) . '&id=') . $data['pid']) . '')), 'news');
                break;
            case 'Wedding':
                $this->requestdata('other');
                $wedding = M('Wedding')->where(array('id' => $data['pid']))->find();
                return array(array(array($wedding['title'], $this->handleIntro($wedding['word']), $wedding['coverurl'], ((((((C('site_url') . '/index.php?g=Wap&m=Wedding&a=index&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName']) . '&id=') . $data['pid']) . '&sgssz=mp.weixin.qq.com'), array('查看我的来宾', $this->handleIntro($wedding['word']), $wedding['picurl'], ((((((C('site_url') . '/index.php?g=Wap&m=Wedding&a=check&type=2&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName']) . '&id=') . $data['pid']) . '&sgssz=mp.weixin.qq.com'), array('查看我的祝福', $this->handleIntro($wedding['word']), $wedding['picurl'], ((((((C('site_url') . '/index.php?g=Wap&m=Wedding&a=check&type=1&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName']) . '&id=') . $data['pid']) . '&sgssz=mp.weixin.qq.com')), 'news');
                break;
            case 'Vote':
                $this->requestdata('other');
                $Vote = M('Vote')->where(array('id' => $data['pid']))->order('id DESC')->find();
                return array(array(array($Vote['title'], $this->handleIntro($Vote['info']), $Vote['picurl'], ((((((C('site_url') . '/index.php?g=Wap&m=Vote&a=index&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName']) . '&id=') . $data['pid']) . '&sgssz=mp.weixin.qq.com')), 'news');
                break;
            case 'Greeting_card':
                $this->requestdata('other');
                $Vote = M('Greeting_card')->where(array('id' => $data['pid']))->order('id DESC')->find();
                return array(array(array($Vote['title'], $this->handleIntro($Vote['info']), $Vote['picurl'], ((C('site_url') . '/index.php?g=Wap&m=Greeting_card&a=index&id=') . $data['pid']) . '&sgssz=mp.weixin.qq.com')), 'news');
                break;
            case 'Lottery':
                $this->requestdata('other');
                $info = M('Lottery')->find($data['pid']);
                if ($info == false || $info['status'] == 3) {
                    return array('活动可能已经结束或者被删除了', 'text');
                }
                switch($info['type']){
            case 1: $model = 'Lottery';
                break;
            case 2: $model = 'Guajiang';
                break;
            case 3: $model = 'Coupon';
                break;
            case 4: $model = 'LuckyFruit';
                break;
            case 5: $model = 'GoldenEgg';
                break;
            case 7: $model = 'AppleGame';
                break;
            case 8: $model = 'Lovers';
                break;
            }
                $id = $info['id'];
                $type = $info['type'];
                if ($info['status'] == 1) {
                    $picurl = $info['starpicurl'];
                    $title = $info['title'];
                    $id = $info['id'];
                    $info = $info['info'];
                } else {
                    $picurl = $info['endpicurl'];
                    $title = $info['endtite'];
                    $info = $info['endinfo'];
                }
                $url = C('site_url') . U((('Wap/' . $model) . '/index'), array('token' => $this->token, 'type' => $type, 'wecha_id' => $this->data['FromUserName'], 'id' => $id, 'type' => $type));
                return array(array(array($title, $this->handleIntro($info), $picurl, $url)), 'news');
            case 'Carowner':
                $this->requestdata('other');
                $thisItem = M('Carowner')->where(array('id' => $data['pid']))->find();
                return array(array(array($thisItem['title'], $this->handleIntro($thisItem['info']), $thisItem['head_url'], (((C('site_url') . '/index.php?g=Wap&m=Car&a=owner&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName'])), 'news');
                break;
            case 'Carset':
                $this->requestdata('other');
                $thisItem = M('Carset')->where(array('id' => $data['pid']))->find();
                $news = array();
                array_push($news, array($thisItem['title'], '', $thisItem['head_url'], $thisItem['url'] ? str_replace(array('{wechat_id}', '{siteUrl}', '&amp;'), array($this->data['FromUserName'], C('site_url'), '&'), $thisItem['url']) : (((C('site_url') . '/index.php?g=Wap&m=Car&a=index&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName']));
                array_push($news, array($thisItem['title1'], '', $thisItem['head_url_1'], $thisItem['url1'] ? str_replace(array('{wechat_id}', '{siteUrl}', '&amp;'), array($this->data['FromUserName'], C('site_url'), '&'), $thisItem['url1']) : (((C('site_url') . '/index.php?g=Wap&m=Car&a=brands&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName']));
                array_push($news, array($thisItem['title2'], '', $thisItem['head_url_2'], $thisItem['url2'] ? str_replace(array('{wechat_id}', '{siteUrl}', '&amp;'), array($this->data['FromUserName'], C('site_url'), '&'), $thisItem['url2']) : (((C('site_url') . '/index.php?g=Wap&m=Car&a=salers&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName']));
                array_push($news, array($thisItem['title3'], '', $thisItem['head_url_3'], $thisItem['url3'] ? str_replace(array('{wechat_id}', '{siteUrl}', '&amp;'), array($this->data['FromUserName'], C('site_url'), '&'), $thisItem['url3']) : (((C('site_url') . '/index.php?g=Wap&m=Car&a=CarReserveBook&addtype=drive&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName']));
                array_push($news, array($thisItem['title4'], '', $thisItem['head_url_4'], $thisItem['url4'] ? str_replace(array('{wechat_id}', '{siteUrl}', '&amp;'), array($this->data['FromUserName'], C('site_url'), '&'), $thisItem['url4']) : (((C('site_url') . '/index.php?g=Wap&m=Car&a=owner&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName']));
                array_push($news, array($thisItem['title5'], '', $thisItem['head_url_5'], $thisItem['url5'] ? str_replace(array('{wechat_id}', '{siteUrl}', '&amp;'), array($this->data['FromUserName'], C('site_url'), '&'), $thisItem['url5']) : (((C('site_url') . '/index.php?g=Wap&m=Car&a=tool&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName']));
                array_push($news, array($thisItem['title6'], '', $thisItem['head_url_6'], $thisItem['url6'] ? str_replace(array('{wechat_id}', '{siteUrl}', '&amp;'), array($this->data['FromUserName'], C('site_url'), '&'), $thisItem['url6']) : (((C('site_url') . '/index.php?g=Wap&m=Car&a=showcar&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName']));
                return array($news, 'news');
                break;
            case 'zhaopianwall':
                $thisItem = M('pic_wall')->where(array('token' => $this->token, 'status' => 1))->order('id desc')->find();
                if (!$thisItem) {
                    return array('图片上墙失败!还未开启照片墙功能。', 'text');
                }
                return array(array(array($thisItem['title'], $this->handleIntro($thisItem['info']), $thisItem['starpicurl'], ((((C('site_url') . '/index.php?g=Wap&m=Zhaopianwall&a=index&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName']) . '&sgssz=mp.weixin.qq.com')), 'news');
                break;
            case 'Shake':
                $thisItem = M('Shake')->where(array('id' => $data['pid']))->find();
                $shakeRecord = M('Shake_rt')->where(array('shakeid' => $data['pid'], 'wecha_id' => $this->data['FromUserName']))->find();
                if (!$shakeRecord) {
                    if ($this->fans['tel']) {
                        $shakeRtRow = array();
                        $shakeRtRow['token'] = $this->token;
                        $shakeRtRow['wecha_id'] = $this->data['FromUserName'];
                        $shakeRtRow['shakeid'] = $thisItem['id'];
                        $shakeRtRow['phone'] = htmlspecialchars($this->fans['tel']);
                        M('Shake_rt')->add($shakeRtRow);
                        return array(array(array($thisItem['title'], (($this->handleIntro($thisItem['intro']) . '。您的电话为:') . $shakeRtRow['phone']) . ',如需修改请回复"yyy+您的手机号"', $thisItem['thumb'], (((((C('site_url') . '/index.php?g=Wap&m=Shake&a=index&id=') . $thisItem['id']) . '&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName'])), 'news');
                    } else {
                        return array('请回复yyy加您的手机号参与活动', 'text');
                    }
                } else {
                    return array(array(array($thisItem['title'], (($this->handleIntro($thisItem['intro']) . '。您的电话为:') . $this->fans['tel']) . ',如需修改请回复"yyy+您的手机号"', $thisItem['thumb'], (((((C('site_url') . '/index.php?g=Wap&m=Shake&a=index&id=') . $thisItem['id']) . '&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName'])), 'news');
                }
                break;
            case 'Wall':
                $thisItem = M('Wall')->where(array('id' => $data['pid']))->find();
                if (!$thisItem['isopen']) {
                    return array('微信墙活动已关闭', 'text');
                } else {
                    $memberRecord = M('Wall_member')->where(array('wallid' => $data['pid'], 'wecha_id' => $this->data['FromUserName']))->find();
                    if (!$memberRecord || !$this->fans) {
                        return array((('<a href="' . C('site_url')) . U('Wap/Userinfo/index', array('token' => $this->token, 'wecha_id' => $this->data['FromUserName'], 'redirect' => ('Wall/person|id:' . intval($data['pid']))))) . '">请点击这里完善信息后再参加此活动</a>', 'text');
                    } else {
                        M('Userinfo')->where(array('token' => $this->token, 'wecha_id' => $this->data['FromUserName']))->save(array('wallopen' => 1));
                        S((('fans_' . $this->token) . '_') . $this->data['FromUserName'], NULL);
                        return array('您已进入微信墙对话模式,您下面发送的所有文字和图片信息都将会显示在大屏幕上,如需退出微信墙模式,请输入“wx#quit”', 'text');
                    }
                }
                break;

			case 'Yuyue': $this -> requestdata('other');
                $pro = M('yuyue') -> where(array('id' => $data['pid'])) -> find();
                return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['topic'], C('site_url') . '/index.php?g=Wap&m=Yuyue&a=index&token=' . $this -> token . '&wecha_id=' . $this -> data['FromUserName'] . '&id=' . $data['pid'])), 'news');
                break;
            case 'Recipe':
                $this->requestdata('other');
                $thisItem = M('Recipe')->where(array('id' => $data['pid']))->find();
                return array(array(array($thisItem['title'], str_replace(array('&nbsp;', 'br /', '&amp;', 'gt;', 'lt;'), '', $this->handleIntro($thisItem['infos'])), $thisItem['headpic'], (((((((C('site_url') . '/index.php?g=Wap&m=Recipe&a=index&token=') . $this->token) . '&type=') . $thisItem['type']) . '&id=') . $thisItem['id']) . 'wecha_id=') . $this->data['FromUserName'])), 'news');
                break;
            case 'Router_config':
                $routerUrl = Router::login($this->token, $this->data['FromUserName']);
                $thisItem = M('Router_config')->where(array('id' => $data['pid']))->find();
                return array(array(array($thisItem['title'], $this->handleIntro($thisItem['info']), $thisItem['picurl'], $routerUrl)), 'news');
                break;
            case 'Schoolset':
                $thisItem = M('School_set_index')->where(array('setid' => $data['pid']))->find();
                return array(array(array($thisItem['title'], $this->handleIntro($thisItem['info']), $thisItem['head_url'], C('site_url') . U('Wap/School/index', array('token' => $this->token, 'wecha_id' => $this->data['FromUserName'])))), 'news');
                break;
			case 'Research':
                $thisItem = M('Research')->where(array('id' => $data['pid']))->find();
                return array(array(array($thisItem['title'], $thisItem['description'], $thisItem['logourl'], $this->siteUrl . U('Wap/Research/index', array('reid' => $data['pid'], 'token' => $this->token, 'wecha_id' => $this->data['FromUserName'])))), 'news');
                break;
            case 'Business':
                $this->requestdata('other');
                $thisItem = M('Busines')->where(array('bid' => $data['pid']))->find();
                return array(array(array($thisItem['title'], str_replace(array('&nbsp;', 'br /', '&amp;', 'gt;', 'lt;'), '', strip_tags(htmlspecialchars_decode($thisItem['business_desc']))), $thisItem['picurl'], ((((((($this->siteUrl . '/index.php?g=Wap&m=Business&a=index&token=') . $this->token) . '&wecha_id=') . $this->data['FromUserName']) . '&bid=') . $thisItem['bid']) . '&type=') . $thisItem['type'])), 'news');
                break;
            case 'Sign':
                $thisItem = M('Sign_set')->where(array('id' => $data['pid']))->find();
                return array(array(array($thisItem['title'], $thisItem['content'], $thisItem['reply_img'], $this->siteUrl . U('Wap/Fanssign/index', array('token' => $this->token, 'wecha_id' => $this->data['FromUserName'])))), 'news');
                break;
            case 'Multi':
                $multiImgClass = new multiImgNews($this->token, $this->data['FromUserName'], $this->siteUrl);
                return $multiImgClass->news($data['pid']);
                break;
            case 'Market':
                $thisItem = M('Market')->where(array('market_id' => $data['pid']))->find();
                return array(array(array($thisItem['title'], $thisItem['address'], $thisItem['logo_pic'], $this->siteUrl . U('Wap/Market/index', array('token' => $this->token, 'wecha_id' => $this->data['FromUserName'])))), 'news');
            default:
                $this->requestdata('videonum');
                $info = M($data['module'])->order('id desc')->find($data['pid']);
                return array(array($info['title'], $info['keyword'], $info['musicurl'], $info['hqmusicurl']), 'music');
            }
        } else {
            if ($this->wxuser['transfer_customer_service']) {
                return array('turn on transfer_customer_service', 'transfer_customer_service');
            }
            $chaFfunction = M('Function')->where(array('funname' => 'liaotian'))->find();
            if (!strpos($this->fun, 'liaotian') || !$chaFfunction['status']) {
                $other = M('Other')->where(array('token' => $this->token))->find();
                if ($other == false) {
                    return array('请在平台里设置回答不上来的回复', 'text');
                } else {
                    if (empty($other['keyword'])) {
                        return array($other['info'], 'text');
                    } else {
                        $img = M('Img')->field('id,text,pic,url,title')->limit(5)->order('id desc')->where(array('token' => $this->token, 'keyword' => array('like', ('%' . $other['keyword']) . '%')))->select();
                        if ($img == false) {
                            return array('无此图文信息,请提醒商家,重新设定关键词', 'text');
                        }
                        foreach ($img as $keya => $infot) {
                            if ($infot['url'] != false) {
                                if (!(strpos($infot['url'], 'http') === FALSE)) {
                                    $url = $this->getFuncLink(html_entity_decode($infot['url']));
                                } else {
                                    $url = $this->getFuncLink($infot['url']);
                                }
                            } else {
                                $url = rtrim(C('site_url'), '/') . U('Wap/Index/content', array('token' => $this->token, 'id' => $infot['id'], 'wecha_id' => $this->data['FromUserName']));
                            }
                            $return[] = array($infot['title'], $infot['text'], $infot['pic'], $url);
                        }
                        return array($return, 'news');
                    }
                }
            }
            if (!C('not_support_chat')) {
                $this->selectService();
            }
            return array($this->chat($key), 'text');
        }
    }
Beispiel #5
0
 private function noreplyReturn()
 {
     $other = M('Other')->where(array('token' => $this->token))->find();
     if ($other == false) {
         return array('', 'text');
     } else {
         if (empty($other['keyword'])) {
             return array($other['info'], 'text');
         } else {
             $img = M('Img')->field('id,text,pic,url,title')->limit(10)->order('usort desc')->where(array('token' => $this->token, 'keyword' => array('like', '%' . $other['keyword'] . '%')))->select();
             if ($img == false) {
                 $multiImgs = M('Img_multi')->where(array('token' => $this->token, 'keywords' => array('like', '%' . $other['keyword'] . '%')))->find();
                 if (!$multiImgs) {
                     return array('无此图文信息,请提醒商家,重新设定关键词', 'text');
                 } else {
                     $multiImgClass = new multiImgNews($this->token, $this->data['FromUserName'], $this->siteUrl);
                     return $multiImgClass->news($multiImgs['id']);
                 }
             }
             foreach ($img as $keya => $infot) {
                 if ($infot['url'] != false) {
                     if (!(strpos($infot['url'], 'http') === false)) {
                         $url = $this->getFuncLink(html_entity_decode($infot['url']));
                     } else {
                         $url = $this->getFuncLink($infot['url']);
                     }
                 } else {
                     $url = rtrim($this->siteUrl, '/') . U('Wap/Index/content', array('token' => $this->token, 'id' => $infot['id'], 'wecha_id' => $this->data['FromUserName']));
                 }
                 $return[] = array($infot['title'], $infot['text'], $infot['pic'], $url);
             }
             return array($return, 'news');
         }
     }
 }
 private function keyword($key)
 {
     switch ($key) {
         case '首页':
         case 'home':
         case 'Home':
             return $this->home();
             break;
         case '主页':
             return $this->home();
             break;
             /**欢仔**/
         /**欢仔**/
         case 'ok':
             $knwx = M('Knwxreplay')->where(array('open' => '1', 'token' => $this->token))->find();
             if ($knwx == false) {
                 return array('目前卡妞微秀模块关闭了', 'text');
             }
             $kndata['token'] = $this->token;
             $kndata['wecha_id'] = $this->data['FromUserName'];
             $kndata['knwxopen'] = 1;
             $kndata['time'] = time();
             $kndata['style'] = 1;
             $kndata['title'] = '我的微秀';
             $res = M('Knwxmy')->where(array('token' => $this->token, 'wecha_id' => $this->data['FromUserName'], 'knwxopen' => 1))->find();
             if ($res == false) {
                 $kndata['catgroy'] = time();
                 $re = M('Knwxmy')->add($kndata);
                 if ($re == false) {
                     return array('无法进入微秀制作模式', 'text');
                 }
             }
             if ($knwx) {
                 S('knwxs_' . $this->token . '_' . $this->data['FromUserName'], NULL);
                 return array('您已经进入了微秀制作模式,回复微秀的内容,可使用文字、图片或照片', 'text');
             }
             break;
         case '我的微秀':
             $pro = M('knwxreplay')->where(array('token' => $this->token))->find();
             $url = C('site_url') . '/index.php?g=Wap&m=Knwx&a=history&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&sgssz=mp.weixin.qq.com';
             return array(array(array('我的微秀', '查看微秀记录!', $pro['pic'], $url)), 'news');
             break;
         case '我的微杂志':
             $pro = M('wzzreplay')->where(array('token' => $this->token))->find();
             $url = C('site_url') . '/index.php?g=Wap&m=Wzz&a=history&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&sgssz=mp.weixin.qq.com';
             return array(array(array('我的微杂志', '查看我的微杂志记录,回复【wzz】可继续制作微杂志', rtrim($this->siteUrl, '/') . '/tpl/static/knwx/wzz.jpg', $url)), 'news');
             break;
         case 'wzz':
             $knwx = M('wzzreplay')->where(array('open' => '1', 'token' => $this->token))->find();
             if ($knwx == false) {
                 return array('目前微杂志模块关闭了', 'text');
             }
             $kndata['token'] = $this->token;
             $kndata['wecha_id'] = $this->data['FromUserName'];
             $kndata['knwxopen'] = 1;
             $kndata['time'] = time();
             $kndata['style'] = 1;
             $kndata['title'] = '我的微杂志';
             $res = M('wzzmy')->where(array('token' => $this->token, 'wecha_id' => $this->data['FromUserName'], 'knwxopen' => 1))->find();
             if ($res == false) {
                 $kndata['catgroy'] = time();
                 $re = M('wzzmy')->add($kndata);
                 if ($re == false) {
                     return array('无法进微杂志制作模式', 'text');
                 }
             }
             if ($knwx) {
                 S('wzz_' . $this->token . '_' . $this->data['FromUserName'], NULL);
                 return array('您已经进入了微杂志制作模式,回复图片即可,或回复“end”,查看微杂志!', 'text');
             }
         case 'Weilive':
             $this->requestdata('other');
             $Weilive = M('Member_business')->where(array('id' => $data['pid']))->find();
             if ($Weilive['url']) {
                 $url = $Weilive['url'];
             } else {
                 $url = C('site_url') . '/index.php?g=Wap&m=Weilive&a=info&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'];
             }
             return array(array(array($Weilive['title'], strip_tags(htmlspecialchars_decode($Weilive['font_summary'])), C('site_url') . $Weilive['font_img'], $url)), 'news');
             break;
             /**欢仔**/
         /**欢仔**/
         case '地图':
             return $this->companyMap();
         case '最近的':
             $this->recordLastRequest($key);
             //查询是否有一分钟内的经纬度
             $user_request_model = M('User_request');
             $loctionInfo = $user_request_model->where(array('token' => $this->token, 'msgtype' => 'location', 'uid' => $this->data['FromUserName']))->find();
             if ($loctionInfo && intval(time() - 60 < $loctionInfo['time'])) {
                 $latLng = explode(',', $loctionInfo['keyword']);
                 return $this->map($latLng[1], $latLng[0]);
             }
             return array('请发送您所在的位置(对话框右下角点击+号,然后点击“位置”)', 'text');
             break;
         case '帮助':
             return $this->help();
             break;
         case 'help':
             return $this->help();
             break;
         case '会员卡':
             return $this->member();
             break;
         case '会员':
             return $this->member();
             break;
         case '3g相册':
             return $this->xiangce();
             break;
         case '相册':
             return $this->xiangce();
             break;
         case '商城':
             $pro = M('reply_info')->where(array('infotype' => 'Shop', 'token' => $this->token))->find();
             $url = $this->siteUrl . '/index.php?g=Wap&m=Store&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '';
             if ($pro['apiurl']) {
                 $url = str_replace('&amp;', '&', $pro['apiurl']);
             }
             return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['picurl'], $url)), 'news');
             break;
         case '订餐':
             $pro = M('reply_info')->where(array('infotype' => 'Dining', 'token' => $this->token))->find();
             $url = $this->siteUrl . '/index.php?g=Wap&m=Repast&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '';
             if ($pro['apiurl']) {
                 $url = str_replace('&amp;', '&', $pro['apiurl']);
             }
             return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['picurl'], $url)), 'news');
             break;
         case '留言':
             $pro = M('reply_info')->where(array('infotype' => 'message', 'token' => $this->token))->find();
             if ($pro) {
                 return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Reply&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '')), 'news');
             } else {
                 return array(array(array('留言板', '在线留言', rtrim($this->siteUrl, '/') . '/tpl/Wap/default/common/css/style/images/ly.jpg', $this->siteUrl . '/index.php?g=Wap&m=Reply&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '')), 'news');
             }
             break;
         case '酒店':
             $pro = M('reply_info')->where(array('infotype' => 'Hotels', 'token' => $this->token))->find();
             if ($pro) {
                 return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Hotels&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'])), 'news');
             } else {
                 return array(array(array('酒店', '酒店在线预订', rtrim($this->siteUrl, '/') . 'tpl/static/images/homelogo.png', $this->siteUrl . '/index.php?g=Wap&m=Hotels&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'])), 'news');
             }
             break;
         case '团购':
             $pro = M('reply_info')->where(array('infotype' => 'Groupon', 'token' => $this->token))->find();
             $url = $this->siteUrl . '/index.php?g=Wap&m=Groupon&a=grouponIndex&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '';
             if ($pro['apiurl']) {
                 $url = str_replace('&amp;', '&', $pro['apiurl']);
             }
             return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['picurl'], $url)), 'news');
             break;
         case '全景':
             $pro = M('reply_info')->where(array('infotype' => 'panorama', 'token' => $this->token))->find();
             if ($pro) {
                 return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Panorama&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '')), 'news');
             } else {
                 return array(array(array('360°全景看车看房', '通过该功能可以实现3D全景看车看房', rtrim($this->siteUrl, '/') . '/tpl/User/default/common/images/panorama/360view.jpg', $this->siteUrl . '/index.php?g=Wap&m=Panorama&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '')), 'news');
             }
             break;
         case '分享达人':
             $Estate = M('sharetalent_reply')->where(array('token' => $this->token))->find();
             return array(array(array($Estate['title'], str_replace('&nbsp;', '', strip_tags(htmlspecialchars_decode($Estate['info']))), $Estate['tp'], $this->siteUrl . '/index.php?g=Wap&m=Sharetalent&a=index&&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&hid=' . $Estate['id'] . '')), 'news');
             break;
         case '微名片':
             $pro = M('vcard')->where(array('token' => $this->token))->find();
             $url = C('site_url') . '/index.php?g=Wap&m=Vcard&a=lists&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&sgssz=mp.weixin.qq.com';
             return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['jianjie'])), $pro['tp'], $url)), 'news');
             break;
             break;
         case '场景应用':
             $pro = M('yingyong_reply')->where(array('token' => $this->token))->find();
             $url = C('site_url') . '/index.php?g=Wap&m=Yingyong&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&sgssz=mp.weixin.qq.com';
             return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['tp'], $url)), 'news');
             break;
         case '主题活动':
             $pro = M('Baoming')->where(array('token' => $this->token))->find();
             $url = C('site_url') . '/index.php?g=Wap&m=Baoming&a=lists&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&sgssz=mp.weixin.qq.com';
             return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['jianjie'])), $pro['tp'], $url)), 'news');
             break;
         case '微方言':
             $pro = M('fanyan_reply')->where(array('token' => $this->token))->find();
             $url = C('site_url') . '/index.php?g=Wap&m=Fanyan&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&sgssz=mp.weixin.qq.com';
             return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['tp'], $url)), 'news');
             break;
         case '答题王':
             $pro = M('jikedati_reply')->where(array('token' => $this->token))->find();
             $url = C('site_url') . '/index.php?g=Wap&m=Jikedati&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&sgssz=mp.weixin.qq.com';
             return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['tp'], $url)), 'news');
             break;
         case '讨论社区':
         case '论坛':
             $fconfig = M('Forum_config')->where(array('token' => $this->token))->find();
             return array(array(array($fconfig['forumname'], str_replace('&nbsp;', '', strip_tags(htmlspecialchars_decode($fconfig['intro']))), $fconfig['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Forum&a=index&&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'])), 'news');
             break;
         case '微商圈':
             $thisItem = M('Market')->where(array('token' => $this->token))->find();
             return array(array(array($thisItem['title'], $thisItem['address'], $thisItem['logo_pic'], $this->siteUrl . U('Wap/Market/index', array('token' => $this->token, 'wecha_id' => $this->data['FromUserName'])))), 'news');
             break;
         case '微招聘':
             $pro = M('zhaopin_reply')->where(array('token' => $this->token))->find();
             if ($pro) {
                 return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['tp'], $this->siteUrl . U('Wap/Zhaopin/index', array('token' => $this->token, 'wecha_id' => $this->data['FromUserName'], 'sgssz' => 'mp.weixin.qq.com'))), array('【找简历】找简历,看这里', strip_tags(htmlspecialchars_decode($pro['info'])), $this->siteUrl . '/tpl/Wap/default/common/zhaopin/jianli.png', $this->siteUrl . U('Wap/Zhaopin/jlindex', array('token' => $this->token, 'wecha_id' => $this->data['FromUserName'], 'sgssz' => 'mp.weixin.qq.com'))), array('【企业版】我要发布招聘', strip_tags(htmlspecialchars_decode($pro['info'])), $this->siteUrl . '/tpl/Wap/default/common/zhaopin/qiye.png', $this->siteUrl . U('Wap/Zhaopin/qiye', array('token' => $this->token, 'wecha_id' => $this->data['FromUserName'], 'sgssz' => 'mp.weixin.qq.com'))), array('【个人版】我要发布简历', strip_tags(htmlspecialchars_decode($pro['info'])), $this->siteUrl . '/tpl/Wap/default/common/zhaopin/geren.png', $this->siteUrl . U('Wap/Zhaopin/geren', array('token' => $this->token, 'wecha_id' => $this->data['FromUserName'], 'sgssz' => 'mp.weixin.qq.com')))), 'news');
             } else {
                 return array('该公众号暂未配置微招聘信息', 'text');
             }
             break;
         case '微商盟':
             $pro = M('fenlei_reply')->where(array('token' => $this->token))->find();
             $url = C('site_url') . '/index.php?g=Wap&m=Fenlei&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&sgssz=mp.weixin.qq.com';
             return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['tp'], $url)), 'news');
             break;
         case '贺卡':
             $heka = M('Heka')->where(array('token' => $this->token))->find();
             if ($heka !== null) {
                 $url = rtrim(C('site_url'), '/') . '/index.php?g=Wap&m=Heka&a=hklist&token=' . $this->token;
                 return array(array(array($heka['title'], $this->handleIntro($heka['info']), $heka['picurl'], $url)), 'news');
             } else {
                 return array('商家未设置贺卡!', 'text');
             }
             break;
             break;
         case '微房产':
             $Estate = M('Estate')->where(array('token' => $this->token))->find();
             return array(array(array($Estate['title'], str_replace('&nbsp;', '', strip_tags(htmlspecialchars_decode($Estate['estate_desc']))), $Estate['cover'], $this->siteUrl . '/index.php?g=Wap&m=Estate&a=index&&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&hid=' . $Estate['id'] . '')), 'news');
             break;
         case '吃粽子':
             $pro = M('czzreply_info')->where(array('token' => $this->token))->find();
             return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Czz&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'])), 'news');
             break;
         case '2048加强版':
             $pro = M('gametreply_info')->where(array('token' => $this->token))->find();
             return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Gamet&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'])), 'news');
             break;
         case 'fly2048':
             $pro = M('gamettreply_info')->where(array('token' => $this->token))->find();
             return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Gamett&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'])), 'news');
             break;
         case '熊出没':
             //BY 20140824
             $pro = M('xcmreply_info')->where(array('token' => $this->token))->find();
             $url = C('site_url') . '/index.php?g=Wap&m=Xcm&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&sgssz=mp.weixin.qq.com';
             return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['picurl'], $url)), 'news');
             //BY h 熊出没结束
             break;
         case '读心术':
             //BY H 20140825
             $pro = M('dxsreply_info')->where(array('token' => $this->token))->find();
             $url = C('site_url') . '/index.php?g=Wap&m=Dxs&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&sgssz=mp.weixin.qq.com';
             return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['picurl'], $url)), 'news');
             //BY h 读心术结束
             break;
         case '微生活':
             $pro = M('weilivereply_info')->where(array('token' => $this->token))->find();
             return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), C('site_url') . $pro['picurl'], C('site_url') . '/index.php?g=Wap&m=Weilive&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'])), 'news');
             break;
     }
     $check = $this->user('diynum', $key);
     if ($check['diynum'] != 1) {
         return array(C('connectout'), 'text');
     }
     $like['keyword'] = $key;
     $like['precisions'] = 1;
     $like['token'] = $this->token;
     $data = M('keyword')->where($like)->order('id desc')->find();
     if (!$data) {
         $like['keyword'] = array('like', '%' . $key . '%');
         $like['precisions'] = 0;
         $data = M('keyword')->where($like)->order('id desc')->find();
     }
     if ($data != false) {
         $this->behaviordata($data['module'], $data['pid']);
         $replyClassName = $data['module'] . 'Reply';
         if (class_exists($replyClassName)) {
             $replyClass = new $replyClassName($this->token, $this->data['FromUserName'], $data, $this->siteUrl, $key);
             return $replyClass->index();
         } else {
             switch ($data['module']) {
                 case 'Img':
                     $this->requestdata('imgnum');
                     $img_db = M($data['module']);
                     $back = $img_db->field('id,text,pic,url,title')->limit(9)->order('usort desc')->where($like)->select();
                     if ($back == false) {
                         return array('‘' . $data['keyword'] . '’无此图文信息或图片,请提醒商家,重新设定关键词', 'text');
                     }
                     $idsWhere = 'id in (';
                     $comma = '';
                     foreach ($back as $keya => $infot) {
                         $idsWhere .= $comma . $infot['id'];
                         $comma = ',';
                         if ($infot['url'] != false) {
                             //处理外链
                             if (!(strpos($infot['url'], 'http') === FALSE)) {
                                 $url = $this->getFuncLink(html_entity_decode($infot['url']));
                             } else {
                                 //内部模块的外链
                                 $url = $this->getFuncLink($infot['url']);
                             }
                         } else {
                             $url = rtrim($this->siteUrl, '/') . U('Wap/Index/content', array('token' => $this->token, 'id' => $infot['id'], 'wecha_id' => $this->data['FromUserName']));
                         }
                         $return[] = array($infot['title'], $this->handleIntro($infot['text']), $infot['pic'], $url);
                     }
                     $idsWhere .= ')';
                     if ($back) {
                         $img_db->where($idsWhere)->setInc('click');
                     }
                     return array($return, 'news');
                     break;
                 case 'Host':
                     $this->requestdata('other');
                     $host = M('Host')->where(array('id' => $data['pid']))->find();
                     return array(array(array($host['name'], $host['info'], $host['ppicurl'], $this->siteUrl . '/index.php?g=Wap&m=Host&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&hid=' . $data['pid'] . '')), 'news');
                     break;
                 case 'Reservation':
                     $this->requestdata('other');
                     $rt = M('Reservation')->where(array('id' => $data['pid']))->find();
                     if (!strpos($rt['picurl'], 'ttp:')) {
                         $rt['picurl'] = $this->siteUrl . $rt['picurl'];
                     }
                     return array(array(array($rt['title'], str_replace(array('&nbsp;', 'br /', '&amp;', 'gt;', 'lt;'), '', strip_tags(htmlspecialchars_decode($rt['info']))), $rt['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Reservation&a=index&rid=' . $data['pid'] . '&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '')), 'news');
                     break;
                 case 'Text':
                     $this->requestdata('textnum');
                     $info = M($data['module'])->order('id desc')->find($data['pid']);
                     return array(htmlspecialchars_decode(str_replace('{wechat_id}', $this->data['FromUserName'], $info['text'])), 'text');
                     break;
                 case 'Product':
                     $this->requestdata('other');
                     $infos = M('Product')->limit(9)->order('id desc')->where($like)->select();
                     if ($infos) {
                         $return = array();
                         foreach ($infos as $info) {
                             if (!$info['groupon']) {
                                 $url = $this->siteUrl . '/index.php?g=Wap&m=Store&a=product&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $info['id'];
                             } else {
                                 $url = $this->siteUrl . '/index.php?g=Wap&m=Groupon&a=product&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $info['id'];
                             }
                             $return[] = array($info['name'], $this->handleIntro(strip_tags(htmlspecialchars_decode($info['intro']))), $info['logourl'], $url);
                         }
                     }
                     return array($return, 'news');
                     break;
                 case 'Selfform':
                     $this->requestdata('other');
                     $pro = M('Selfform')->where(array('id' => $data['pid']))->find();
                     return array(array(array($pro['name'], strip_tags(htmlspecialchars_decode($pro['intro'])), $pro['logourl'], $this->siteUrl . '/index.php?g=Wap&m=Selfform&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . '')), 'news');
                     break;
                 case 'Jingcai':
                     $this->requestdata('other');
                     $pro = M('jingcai_set')->where(array('id' => $data['pid']))->find();
                     return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['cover'], $this->siteUrl . '/index.php?g=Wap&m=Jingcai&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . '')), 'news');
                     break;
                 case 'Live':
                     $this->requestdata('other');
                     $pro = M('live')->where(array('id' => $data['pid']))->find();
                     return array(array(array($pro['name'], strip_tags(htmlspecialchars_decode($pro['intro'])), $pro['logourl'], $this->siteUrl . '/index.php?g=Wap&m=Live&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . '')), 'news');
                     break;
                 case 'Problem':
                     $this->requestdata('other');
                     $pro = M('problem_game')->where(array('id' => $data['pid']))->find();
                     return array(array(array($pro['name'], strip_tags(htmlspecialchars_decode($pro['explain'])), $pro['logo_pic'], $this->siteUrl . '/index.php?g=Wap&m=Problem&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . '')), 'news');
                     break;
                 case 'Custom':
                     $this->requestdata('other');
                     $pro = M('Custom_set')->where(array('set_id' => $data['pid']))->find();
                     return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['intro'])), $pro['top_pic'], $this->siteUrl . '/index.php?g=Wap&m=Custom&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . '')), 'news');
                     break;
                 case 'Panorama':
                     $this->requestdata('other');
                     $pro = M('Panorama')->where(array('id' => $data['pid']))->find();
                     return array(array(array($pro['name'], strip_tags(htmlspecialchars_decode($pro['intro'])), $pro['frontpic'], $this->siteUrl . '/index.php?g=Wap&m=Panorama&a=item&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . '')), 'news');
                     break;
                 case 'Wedding':
                     $this->requestdata('other');
                     $wedding = M('Wedding')->where(array('id' => $data['pid']))->find();
                     return array(array(array($wedding['title'], strip_tags(htmlspecialchars_decode($wedding['word'])), $wedding['coverurl'], $this->siteUrl . '/index.php?g=Wap&m=Wedding&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . ''), array('查看我的祝福', strip_tags(htmlspecialchars_decode($wedding['word'])), $wedding['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Wedding&a=check&type=1&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . ''), array('查看我的来宾', strip_tags(htmlspecialchars_decode($wedding['word'])), $wedding['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Wedding&a=check&type=2&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . '')), 'news');
                     break;
                 case 'Vote':
                     $this->requestdata('other');
                     $Vote = M('Vote')->where(array('id' => $data['pid']))->order('id DESC')->find();
                     return array(array(array($Vote['title'], '', $Vote['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Vote&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . '')), 'news');
                     break;
                 case 'Hforward':
                     $this->requestdata('other');
                     $Hforward = M('Hforward')->where(array('id' => $data['pid']))->order('id DESC')->find();
                     return array(array(array($Hforward['title'], $this->handleIntro($Hforward['jianjie']), $Hforward['picurl'], C('site_url') . '/index.php?g=Wap&m=Hforward&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . '&sgssz=mp.weixin.qq.com')), 'news');
                     break;
                 case 'Greeting_card':
                     $this->requestdata('other');
                     $Vote = M('Greeting_card')->where(array('id' => $data['pid']))->order('id DESC')->find();
                     return array(array(array($Vote['title'], str_replace(array('&nbsp;', 'br /', '&amp;', 'gt;', 'lt;'), '', strip_tags(htmlspecialchars_decode($Vote['info']))), $Vote['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Greeting_card&a=index&id=' . $data['pid'] . '')), 'news');
                     break;
                 case 'Estate':
                     $this->requestdata('other');
                     $Estate = M('Estate')->where(array('id' => $data['pid']))->find();
                     return array(array(array($Estate['title'], $Estate['estate_desc'], $Estate['cover'], $this->siteUrl . '/index.php?g=Wap&m=Estate&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . ''), array('楼盘介绍', $Estate['estate_desc'], $Estate['house_banner'], $this->siteUrl . '/index.php?g=Wap&m=Estate&a=index&&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&hid=' . $data['pid'] . ''), array('专家点评', $Estate['estate_desc'], $Estate['cover'], $this->siteUrl . '/index.php?g=Wap&m=Estate&a=impress&&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&hid=' . $data['pid'] . ''), array('楼盘3D全景', $Estate['estate_desc'], $Estate['banner'], $this->siteUrl . '/index.php?g=Wap&m=Panorama&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&hid=' . $data['pid'] . ''), array('楼盘动态', $Estate['estate_desc'], $Estate['house_banner'], $this->siteUrl . '/index.php?g=Wap&m=Index&a=lists&classid=' . $Estate['classify_id'] . '&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&hid=' . $data['pid'] . '')), 'news');
                     break;
                 case 'Invites':
                     $this->requestdata('other');
                     $info = M('Invites')->where(array('id' => $data['pid']))->find();
                     if ($info == false) {
                         return array('商家未做邀请回复配置,请稍后再试', 'text');
                     }
                     return array(array(array($info['title'], $this->handleIntro($info['brief']), $info['picurl'], C('site_url') . U('Wap/Invites/index', array('token' => $this->token, 'id' => $info['id'])))), 'news');
                     break;
                 case 'Vcard':
                     $this->requestdata('other');
                     $vcard = M('vcard_list')->where(array('token' => $this->token, 'name' => $key))->find();
                     if ($vcard) {
                         return array(array(array($vcard['name'], $vcard['work'], $vcard['image'], $this->siteUrl . U('Wap/Vcard/index', array('token' => $this->token, 'wecha_id' => $this->data['FromUserName'], 'id' => $vcard['id'])))), 'news');
                     }
                     break;
                 case 'Paper':
                     $this->requestdata('other');
                     $Paper = M('Paper')->where(array('id' => $data['pid']))->find();
                     return array(array(array($Paper['title'], strip_tags(htmlspecialchars_decode($Paper['title'])), $Paper['pic'], $this->siteUrl . '/index.php?g=Wap&m=Paper&a=item&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . '')), 'news');
                     break;
                 case 'Hcar':
                     $this->requestdata('other');
                     $Hcarreplay = M('Hcarreplay')->where(array('id' => $data['pid']))->order('id DESC')->find();
                     return array(array(array($Hcarreplay['title'], $this->handleIntro($Hcarreplay['jianjie']), $Hcarreplay['pic'], C('site_url') . '/index.php?g=Wap&m=Hcar&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . '&sgssz=mp.weixin.qq.com')), 'news');
                     break;
                 case 'Knwx':
                     $this->requestdata('other');
                     $Knwxreplay = M('Knwxreplay')->where(array('id' => $data['pid']))->order('id DESC')->find();
                     return array(array(array($Knwxreplay['title'], $this->handleIntro($Knwxreplay['jianjie']), $Knwxreplay['pic'], C('site_url') . '/index.php?g=Wap&m=Knwx&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . '&sgssz=mp.weixin.qq.com')), 'news');
                     break;
                 case 'Kawahk':
                     $this->requestdata('other');
                     $Hcarreplay = M('Kawahkreplay')->where(array('id' => $data['pid']))->order('id DESC')->find();
                     return array(array(array($Hcarreplay['title'], $this->handleIntro($Hcarreplay['jianjie']), $Hcarreplay['pic'], C('site_url') . '/index.php?g=Wap&m=Kawahk&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . '&sgssz=mp.weixin.qq.com')), 'news');
                     break;
                 case 'Xinniannq':
                     $this->requestdata('other');
                     $Hcarreplay = M('Xinniannqreplay')->where(array('id' => $data['pid']))->order('id DESC')->find();
                     return array(array(array($Hcarreplay['title'], $this->handleIntro($Hcarreplay['jianjie']), $Hcarreplay['pic'], C('site_url') . '/index.php?g=Wap&m=Xinniannq&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . '&sgssz=mp.weixin.qq.com')), 'news');
                     break;
                 case 'Musiccar':
                     $this->requestdata('other');
                     $Musiccar = M('Musiccar')->where(array('id' => $data['pid']))->order('id DESC')->find();
                     return array(array(array($Musiccar['title'], $this->handleIntro($Musiccar['jianjie']), $Musiccar['pic'], C('site_url') . '/index.php?g=Wap&m=Musiccar&a=index&tx=1&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . '&sgssz=mp.weixin.qq.com')), 'news');
                     break;
                 case 'Jiejing':
                     $this->requestdata('other');
                     $Jiejing = M('Jiejing')->where(array('token' => $data['token']))->find();
                     $url = 'http://apis.map.qq.com/uri/v1/streetview?pano=' . $Jiejing['pano'] . '&heading=30&pitch=10';
                     return array(array(array($Jiejing['title'], $Jiejing['text'], C('site_url') . $Jiejing['picurl'], $url)), 'news');
                     break;
                 case 'RippleOS_url':
                     $this->requestdata('textnum');
                     $node = D('Rippleos_node')->where(array('id' => $data['pid']))->find();
                     $ret_json = $this->rippleos_auth_url($node['node']);
                     if (is_array($node) && $ret_json['status'] === 0) {
                         $ret = '<a href="' . $ret_json['auth_url'] . '">' . $node['text'] . '</a>';
                     } else {
                         $ret = $this->rptk_err_msg[abs($ret_json['status'])];
                     }
                     return array(htmlspecialchars_decode($ret), 'text');
                     break;
                 case 'RippleOS_code':
                     $this->requestdata('textnum');
                     $node = D('Rippleos_node')->where(array('id' => $data['pid']))->find();
                     $ret_json = $this->rippleos_auth_token($node['node']);
                     if (is_array($node) && $ret_json['status'] === 0) {
                         $ret = '上网验证码:' . $ret_json['auth_token'] . '(验证码有效期为10分钟)';
                     } else {
                         $ret = $this->rptk_err_msg[abs($ret_json['status'])];
                     }
                     return array(htmlspecialchars_decode($ret), 'text');
                     break;
                 case 'Lottery':
                     $this->requestdata('other');
                     $info = M('Lottery')->find($data['pid']);
                     if ($info == false || $info['status'] == 3) {
                         return array('活动可能已经结束或者被删除了', 'text');
                     }
                     switch ($info['type']) {
                         case 1:
                             $model = 'Lottery';
                             break;
                         case 2:
                             $model = 'Guajiang';
                             break;
                         case 3:
                             $model = 'Coupon';
                             break;
                         case 4:
                             $model = 'LuckyFruit';
                             break;
                         case 5:
                             $model = 'GoldenEgg';
                             break;
                         case 7:
                             $model = 'AppleGame';
                             break;
                         case 8:
                             $model = 'Lovers';
                             break;
                         case 9:
                             $model = 'Autumn';
                             break;
                         case 10:
                             $model = 'Jiugong';
                             break;
                     }
                     $id = $info['id'];
                     $type = $info['type'];
                     if ($info['status'] == 1) {
                         $picurl = $info['starpicurl'];
                         $title = $info['title'];
                         $id = $info['id'];
                         $info = $info['info'];
                     } else {
                         $picurl = $info['endpicurl'];
                         $title = $info['endtite'];
                         $info = $info['endinfo'];
                     }
                     $url = $this->siteUrl . U('Wap/' . $model . '/index', array('token' => $this->token, 'type' => $type, 'wecha_id' => $this->data['FromUserName'], 'id' => $id, 'type' => $type));
                     return array(array(array($title, $info, $picurl, $url)), 'news');
                 case 'Carowner':
                     $this->requestdata('other');
                     $thisItem = M('Carowner')->where(array('id' => $data['pid']))->find();
                     return array(array(array($thisItem['title'], str_replace(array('&nbsp;', 'br /', '&amp;', 'gt;', 'lt;'), '', strip_tags(htmlspecialchars_decode($thisItem['info']))), $thisItem['head_url'], $this->siteUrl . '/index.php?g=Wap&m=Car&a=owner&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . '')), 'news');
                     break;
                 case 'Carowner':
                     $this->requestdata('other');
                     $thisItem = M('Carowner')->where(array('id' => $data['pid']))->find();
                     return array(array(array($thisItem['title'], str_replace(array('&nbsp;', 'br /', '&amp;', 'gt;', 'lt;'), '', strip_tags(htmlspecialchars_decode($thisItem['info']))), $thisItem['head_url'], $this->siteUrl . '/index.php?g=Wap&m=Car&a=owner&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'])), 'news');
                     break;
                 case 'Carset':
                     $this->requestdata('other');
                     $thisItem = M('Carset')->where(array('id' => $data['pid']))->find();
                     $news = array();
                     array_push($news, array($thisItem['title'], '', $thisItem['head_url'], $thisItem['url'] ? $thisItem['url'] : $this->siteUrl . '/index.php?g=Wap&m=Car&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName']));
                     array_push($news, array($thisItem['title1'], '', $thisItem['head_url_1'], $thisItem['url1'] ? $thisItem['url1'] : $this->siteUrl . '/index.php?g=Wap&m=Car&a=brands&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName']));
                     array_push($news, array($thisItem['title2'], '', $thisItem['head_url_2'], $thisItem['url2'] ? $thisItem['url2'] : $this->siteUrl . '/index.php?g=Wap&m=Car&a=salers&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName']));
                     array_push($news, array($thisItem['title3'], '', $thisItem['head_url_3'], $thisItem['url3'] ? $thisItem['url3'] : $this->siteUrl . '/index.php?g=Wap&m=Car&a=CarReserveBook&addtype=drive&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName']));
                     array_push($news, array($thisItem['title4'], '', $thisItem['head_url_4'], $thisItem['url4'] ? $thisItem['url4'] : $this->siteUrl . '/index.php?g=Wap&m=Car&a=owner&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName']));
                     array_push($news, array($thisItem['title5'], '', $thisItem['head_url_5'], $thisItem['url5'] ? $thisItem['url5'] : $this->siteUrl . '/index.php?g=Wap&m=Car&a=tool&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName']));
                     array_push($news, array($thisItem['title6'], '', $thisItem['head_url_6'], $thisItem['url6'] ? $thisItem['url6'] : $this->siteUrl . '/index.php?g=Wap&m=Car&a=showcar&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName']));
                     return array($news, 'news');
                     break;
                 case 'medicalSet':
                     $thisItem = M('Medical_set')->where(array('id' => $data['pid']))->find();
                     return array(array(array($thisItem['title'], str_replace(array('&nbsp;', 'br /', '&amp;', 'gt;', 'lt;'), '', strip_tags(htmlspecialchars_decode($thisItem['info']))), $thisItem['head_url'], $this->siteUrl . '/index.php?g=Wap&m=Medical&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'])), 'news');
                     break;
                 case 'zhaopianwall':
                     $thisItem = M('pic_wall')->where(array('token' => $this->token, 'status' => 1))->order('id desc')->find();
                     if (!$thisItem) {
                         return array('图片上墙失败!还未开启照片墙功能。', 'text');
                     }
                     return array(array(array($thisItem['title'], $this->handleIntro($thisItem['info']), $thisItem['starpicurl'], C('site_url') . '/index.php?g=Wap&m=Zhaopianwall&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&sgssz=mp.weixin.qq.com')), 'news');
                     break;
                 case 'Jiejing':
                     $this->requestdata('other');
                     $Jiejing = M('Jiejing')->where(array('token' => $data['token']))->find();
                     $url = 'http://apis.map.qq.com/uri/v1/streetview?pano=' . $Jiejing['pano'] . '&heading=30&pitch=10';
                     return array(array(array($Jiejing['title'], $Jiejing['text'], $Jiejing['picurl'], $url)), 'news');
                     break;
                 case 'Yuyue':
                     $this->requestdata('other');
                     $pro = M('yuyue')->where(array('id' => $data['pid']))->find();
                     return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['topic'], C('site_url') . '/index.php?g=Wap&m=Yuyue&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'])), 'news');
                     break;
                 case 'Lapiao':
                     $this->requestdata('other');
                     $pro = M('lapiao')->where(array('id' => $data['pid']))->order('id DESC')->find();
                     return array(array(array($pro['name'], strip_tags(htmlspecialchars_decode($pro['ms'])), $pro['pic'], $this->siteUrl . U('Wap/Lapiao/index', array('token' => $this->token, 'wecha_id' => $this->data['FromUserName'], 'id' => $data['pid'])))), 'news');
                     break;
                 case 'Helping':
                     $this->requestdata('other');
                     $pro = M('helping')->where(array('id' => $data['pid']))->find();
                     return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['intro'])), $pro['reply_pic'], $this->siteUrl . '/index.php?g=Wap&m=Helping&a=index&id=' . $data['pid'] . '&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '')), 'news');
                     break;
                 case 'MicroBroker':
                     $this->requestdata('other');
                     $pro = M('broker')->where(array('id' => $data['pid']))->find();
                     return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['ruledesc'])), $pro['picurl'], $this->siteUrl . '/index.php?g=Wap&m=MicroBroker&a=index&bid=' . $data['pid'] . '&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '')), 'news');
                     break;
                 case 'Popularity':
                     $this->requestdata('other');
                     $pro = M('popularity')->where(array('id' => $data['pid']))->find();
                     return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['pic'], $this->siteUrl . '/index.php?g=Wap&m=Popularity&a=index&id=' . $data['pid'] . '&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '')), 'news');
                     break;
                 case 'Mbvote':
                     $this->requestdata('other');
                     $pro = M('Mbvote')->where(array('id' => $data['pid']))->find();
                     return array(array(array($pro['title'], strip_tags(htmlspecialchars_decode($pro['info'])), $pro['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Weimicmsvote&a=index&id=' . $data['pid'] . '&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '')), 'news');
                     break;
                 case 'Shake':
                     $thisItem = M('Shake')->where(array('id' => $data['pid']))->find();
                     if (!$thisItem['isopen']) {
                         return array('摇一摇活动已关闭', 'text');
                     } else {
                         $actid = $data['pid'];
                         $acttype = 2;
                         $memberRecord = M('Wall_member')->where(array('act_id' => $actid, 'act_type' => $acttype, 'wecha_id' => $this->data['FromUserName']))->find();
                         if (!$memberRecord) {
                             return array(array(array($thisItem['title'], '请点击这里完善信息后再参加此活动', $thisItem['logo'], C('site_url') . U('Wap/Scene_member/index', array('token' => $this->token, 'wecha_id' => $this->data['FromUserName'], 'act_type' => $acttype, 'id' => $actid, 'name' => 'shake')))), 'news');
                         } else {
                             return array(array(array($thisItem['title'], '点击这里确认个人信息', $thisItem['logo'], C('site_url') . U('Wap/Scene_member/index', array('token' => $this->token, 'wecha_id' => $this->data['FromUserName'], 'act_type' => $acttype, 'id' => $actid, 'name' => 'shake')))), 'news');
                         }
                     }
                     break;
                 case 'Wall':
                 case 'Scene':
                     if ($data['module'] == 'Wall') {
                         $act_model = M('Wall');
                     } else {
                         $act_model = M('Wechat_scene');
                     }
                     $thisItem = $act_model->where(array('id' => $data['pid']))->find();
                     if ($data['module'] == 'Wall') {
                         $acttype = 1;
                         $isopen = $thisItem['isopen'];
                         $picLogo = $thisItem['startbackground'];
                     } else {
                         $acttype = 3;
                         $isopen = $thisItem['is_open'];
                         $picLogo = $thisItem['pic'];
                     }
                     $str = $this->wallStr($acttype, $thisItem);
                     if (!$isopen) {
                         return array($thisItem['title'] . '活动已关闭', 'text');
                     } else {
                         $actid = $data['pid'];
                         $memberRecord = M('Wall_member')->where(array('act_id' => $actid, 'act_type' => $acttype, 'wecha_id' => $this->data['FromUserName']))->find();
                         if (!$memberRecord) {
                             return array(array(array($thisItem['title'], '请点击这里完善信息后再参加此活动', $picLogo, $this->siteUrl . U('Wap/Scene_member/index', array('token' => $this->token, 'wecha_id' => $this->data['FromUserName'], 'act_type' => $acttype, 'id' => $actid, 'name' => 'wall')))), 'news');
                         } else {
                             D('Userinfo')->where(array('token' => $this->token, 'wecha_id' => $this->data['FromUserName']))->save(array('wallopen' => 1));
                             S('fans_' . $this->token . '_' . $this->data['FromUserName'], NULL);
                             return array($str, 'text');
                         }
                     }
                     break;
                 case 'Recipe':
                     $this->requestdata('other');
                     $thisItem = M('Recipe')->where(array('id' => $data['pid']))->find();
                     return array(array(array($thisItem['title'], str_replace(array('&nbsp;', 'br /', '&amp;', 'gt;', 'lt;'), '', strip_tags(htmlspecialchars_decode($thisItem['infos']))), $thisItem['headpic'], $this->siteUrl . '/index.php?g=Wap&m=Recipe&a=index&token=' . $this->token . '&type=' . $thisItem['type'] . '&id=' . $thisItem['id'] . 'wecha_id=' . $this->data['FromUserName'])), 'news');
                     break;
                 case 'Router_config':
                     $routerUrl = Router::login($this->token, $this->data['FromUserName']);
                     $thisItem = M('Router_config')->where(array('id' => $data['pid']))->find();
                     return array(array(array($thisItem['title'], $thisItem['info'], $thisItem['picurl'], $routerUrl)), 'news');
                     break;
                 case 'Schoolset':
                     $thisItem = M('School_set_index')->where(array('setid' => $data['pid']))->find();
                     return array(array(array($thisItem['title'], $thisItem['info'], $thisItem['head_url'], $this->siteUrl . U('Wap/School/index', array('token' => $this->token, 'wecha_id' => $this->data['FromUserName'])))), 'news');
                     break;
                 case 'Research':
                     $thisItem = M('Research')->where(array('id' => $data['pid']))->find();
                     return array(array(array($thisItem['title'], $thisItem['description'], $thisItem['logourl'], $this->siteUrl . U('Wap/Research/index', array('reid' => $data['pid'], 'token' => $this->token, 'wecha_id' => $this->data['FromUserName'])))), 'news');
                     break;
                 case 'Business':
                     $this->requestdata('other');
                     $thisItem = M('Busines')->where(array('bid' => $data['pid']))->find();
                     return array(array(array($thisItem['title'], str_replace(array('&nbsp;', 'br /', '&amp;', 'gt;', 'lt;'), '', strip_tags(htmlspecialchars_decode($thisItem['business_desc']))), $thisItem['picurl'], $this->siteUrl . '/index.php?g=Wap&m=Business&a=index&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&bid=' . $thisItem['bid'] . '&type=' . $thisItem['type'])), 'news');
                     break;
                 case 'Sign':
                     $thisItem = M('Sign_set')->where(array('id' => $data['pid']))->find();
                     return array(array(array($thisItem['title'], $thisItem['content'], $thisItem['reply_img'], $this->siteUrl . U('Wap/Fanssign/index', array('token' => $this->token, 'wecha_id' => $this->data['FromUserName'], 'id' => $data['pid'])))), 'news');
                     break;
                 case 'Multi':
                     $multiImgClass = new multiImgNews($this->token, $this->data['FromUserName'], $this->siteUrl);
                     return $multiImgClass->news($data['pid']);
                     break;
                 case 'Market':
                     $thisItem = M('Market')->where(array('market_id' => $data['pid']))->find();
                     return array(array(array($thisItem['title'], $thisItem['address'], $thisItem['logo_pic'], $this->siteUrl . U('Wap/Market/index', array('token' => $this->token, 'wecha_id' => $this->data['FromUserName'])))), 'news');
                 default:
                     $replyClassName = $data['module'] . 'Reply';
                     if (class_exists($replyClassName)) {
                         $replyClass = new $replyClassName($this->token, $this->data['FromUserName'], $data, $this->siteUrl);
                         return $replyClass->index();
                     } else {
                         $this->requestdata('videonum');
                         $info = M($data['module'])->order('id desc')->find($data['pid']);
                         return array(array($info['title'], $info['keyword'], $info['musicurl'], $info['hqmusicurl']), 'music');
                     }
             }
         }
     } else {
         $nokeywordReply = $this->nokeywordApi();
         if ($nokeywordReply) {
             return $nokeywordReply;
         }
         if ($this->wxuser['transfer_customer_service']) {
             return array('turn on transfer_customer_service', 'transfer_customer_service');
         }
         $lprd = M('lapiao_record')->where(array('token' => $this->token, 'sn' => $key))->find();
         if ($lprd) {
             $lp = M('lapiao')->where(array('id' => $lprd['tid']))->find();
             $time = date('Y-m-d H:i:s', time());
             if ($lp['kssj'] > $time) {
                 return array('拉票活动还没开始', 'text');
             }
             if ($lp['jssj'] < $time) {
                 return array('拉票活动已经结束', 'text');
             }
             $lptp = M('lapiao_toupiao')->where(array('wxid' => $this->data['FromUserName'], 'tid' => $lprd['tid'], 'sn' => $key))->find();
             if ($lptp) {
                 return array('你已经给Ta投过票了,快去拉小伙伴来投吧', 'text');
             }
             // 插入投票数据
             $lptp['wxid'] = $this->data['FromUserName'];
             $lptp['sn'] = $key;
             $lptp['tid'] = $lprd['tid'];
             M('lapiao_toupiao')->add($lptp);
             $lprd['sl'] = $lprd['sl'] + 1;
             M('lapiao_record')->save($lprd);
             return array('给【' . $lprd['un'] . '】投票成功', 'text');
         }
         $chaFfunction = M('Function')->where(array('funname' => 'liaotian'))->find();
         if (!strpos($this->fun, 'liaotian') || !$chaFfunction['status']) {
             if ($keyarray[1] == 'noreplyReturn') {
                 return array('要不要这么难,这个我回答不上来。%>_<%', 'text');
                 exit;
             } else {
                 return $this->noreplyReturn();
             }
         }
         if (!C('not_support_chat')) {
             $this->selectService();
         }
         return array($this->chat($key), 'text');
     }
 }