Example #1
0
	public function index(){
		$routerUrl=Router::login($this->token,'wechaid');
		//
		$db=D('Router');
		$where=array('token'=>$this->token);
		$count=$db->where($where)->count();
		$page=new Page($count,25);
		$info=$db->where($where)->order('id DESC')->limit($page->firstRow.','.$page->listRows)->select();
		$this->assign('page',$page->show());
		$this->assign('info',$info);
		$this->assign('tab','list');
		$this->display();
	}
Example #2
0
 private function wysw()
 {
     $routerUrl = Router::login($this->token, $this->data['FromUserName']);
     $thisItem = M('Router_config')->where(array('token' => $this->token))->find();
     return array(array(array($thisItem['title'], $thisItem['info'], $thisItem['picurl'], $routerUrl)), 'news');
 }
    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');
        }
    }
Example #4
0
 private function keyword($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']);
                 $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(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 'Host':
                 $this->requestdata('other');
                 $host = M('Host')->where(array('id' => $data['pid']))->find();
                 return array(array(array($host['name'], $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 'Estate':
                 $this->requestdata('other');
                 $Estate = M('Estate')->where(array('id' => $data['pid']))->find();
                 return array(array(array($Estate['title'], $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('楼盘介绍', $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('专家点评', $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全景', $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('楼盘动态', $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'], $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 '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'], strip_tags(htmlspecialchars_decode($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['name'], strip_tags(htmlspecialchars_decode($pro['intro'])), $pro['frontpic'], 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 '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'], 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('查看我的祝福', strip_tags(htmlspecialchars_decode($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'), array('查看我的来宾', strip_tags(htmlspecialchars_decode($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')), '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'], 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'], str_replace(array('&nbsp;', 'br /', '&amp;', 'gt;', 'lt;'), '', strip_tags(htmlspecialchars_decode($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;
                 }
                 $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, $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'], C('site_url') . '/index.php?g=Wap&m=Car&a=owner&token=' . $this->token . '&wecha_id=' . $this->data['FromUserName'] . '&id=' . $data['pid'] . '&sgssz=mp.weixin.qq.com')), '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'], 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'] ? $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'] ? $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'] ? $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'] ? $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'] ? $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'] ? $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'] ? $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 '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'], C('site_url') . '/index.php?g=Wap&m=Medical&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'], 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('请回复shake加您的手机号参与活动', 'text');
                     }
                 } else {
                     return array(array(array($thisItem['title'], $thisItem['intro'] . '。您的电话为:' . $this->fans['tel'] . ',如需修改请回复"shake+您的手机号"', $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 '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'], 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'], $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'], C('site_url') . U('Wap/School/index', array('token' => $this->token, 'wecha_id' => $this->data['FromUserName'])))), 'news');
                 break;
             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');
     }
 }