<?php


class StatisticsAction extends UserAction{public $IIIIIIl1l1Il;public $IIIIII1I111I;public function _initialize() {parent::_initialize();$this->IIIIIIIIlIlI='yicms';$IIIIIIIIlIl1=array('token'=>$this->IIIIIIIIlIlI);$this->IIIIIIl1l1Il=M('Wxuser')->where($IIIIIIIIlIl1)->find();if (!$this->IIIIIIl1l1Il['appid']||!$this->IIIIIIl1l1Il['appsecret']){$this->error('请先设置AppID和AppSecret再使用本功能，谢谢','?g=User&m=Index&a=edit&id='.$this->IIIIIIl1l1Il['id']);}if ($this->IIIIIIl1l1Il['winxintype']!=3){$this->error('只有微信官方认证的高级服务号才能使用本功能','?g=User&m=Index&a=edit&id='.$this->IIIIIIl1l1Il['id']);}$this->IIIIII1I111I=array( 'home'=>array('name'=>'微网站'),'text'=>array('name'=>'文本请求'),'member_card_set'=>array('name'=>'会员卡'),'lottery'=>array('name'=>'推广活动'),'help'=>array('name'=>'帮助'),'wedding'=>array('name'=>'婚庆喜帖'),'img'=>array('name'=>'图文消息'),'selfform'=>array('name'=>'万能表单'),'host'=>array('name'=>'通用订单'),'panorama'=>array('name'=>'全景'),'usernamecheck'=>array('name'=>'账号审核'),'album'=>array('name'=>'相册'),'vote'=>array('name'=>'投票'),'product'=>array('name'=>'商城'),'voiceresponse'=>array('name'=>'语音消息'),'estate'=>array('name'=>'房产'),);}public function index(){switch ($_GET['type']){case 1: $IIIIIlIlI1lI=M('Wechat_group_list');$IIIIIIIIlIl1=array('token'=>$this->IIIIIIIIlIlI);$IIIIIlIlI1ll=$IIIIIlIlI1lI->where($IIIIIIIIlIl1)->count();$IIIIIIIIlIl1['sex']=1;$IIIIIlIlI1l1=$IIIIIlIlI1lI->where($IIIIIIIIlIl1)->count();$IIIIIIIIlIl1['sex']=2;$IIIIIlIlI11I=$IIIIIlIlI1lI->where($IIIIIIIIlIl1)->count();$this->assign('fansCount',$IIIIIlIlI1ll);$this->assign('maleCount',$IIIIIlIlI1l1);$this->assign('femaleCount',$IIIIIlIlI11I);$IIIIIlIlI11l=$IIIIIlIlI1ll-$IIIIIlIlI1l1-$IIIIIlIlI11I;$this->assign('unknownSexCount',$IIIIIlIlI11l);$IIIIIlIIll11='<chart borderThickness="0" caption="粉丝性别比例图" baseFontColor="666666" baseFont="宋体" baseFontSize="14" bgColor="FFFFFF" bgAlpha="0" showBorder="0" bgAngle="360" pieYScale="90"  pieSliceDepth="5" smartLineColor="666666"><set label="男性" value="'.$IIIIIlIlI1l1.'"/><set label="女性" value="'.$IIIIIlIlI11I.'"/><set label="未知性别" value="'.$IIIIIlIlI11l.'"/></chart>';$this->assign('xml',$IIIIIlIIll11);break;case 2: $IIIIIIlIlIll=$this->_get('openid');$IIIIIIIIlIl1=array('token'=>$this->IIIIIIIIlIlI);if ($IIIIIIlIlIll){$IIIIIIIIlIl1['openid']=$IIIIIIlIlIll;}$IIIIIlIlI111=M('Behavior');$IIIIII1lIII1=$IIIIIlIlI111->where($IIIIIIIIlIl1)->order('num DESC')->select();$IIIIIIlI11Il=array();if ($IIIIII1lIII1){foreach ($IIIIII1lIII1 as $IIIIII1Il1I1){$IIIIIlIllIII=strtolower($IIIIII1Il1I1['model']);if (key_exists($IIIIIlIllIII,$IIIIIIlI11Il)){$IIIIIIlI11Il[$IIIIIlIllIII]++;}else {$IIIIIIlI11Il[$IIIIIlIllIII]=1;}}}asort($IIIIIIlI11Il);$IIIIIlIIll11='<chart borderThickness="0" caption="粉丝行为分析" baseFontColor="666666" baseFont="宋体" baseFontSize="14" bgColor="FFFFFF" bgAlpha="0" showBorder="0" bgAngle="360" pieYScale="90"  pieSliceDepth="5" smartLineColor="666666">';if ($IIIIIIlI11Il){foreach ($IIIIIIlI11Il as $IIIIIIIllIll=>$IIIIIIlIllII){$IIIIIlIIll11.='<set label="'.$this->IIIIII1I111I[$IIIIIIIllIll]['name'].'" value="'.$IIIIIIlIllII.'"/>';}}$IIIIIlIIll11.='</chart>';$this->assign('items',$IIIIII1lIII1);$this->assign('xml',$IIIIIlIIll11);break;case 3: $IIIIIIlIlIll=$this->_get('openid');$IIIIIIIIlIl1=array('token'=>$this->IIIIIIIIlIlI);$IIIIIIIIlIl1['enddate']=array('gt',time()-30*24*3600);$IIIIIlIlI111=M('Behavior');$IIIIII1lIII1=$IIIIIlIlI111->where($IIIIIIIIlIl1)->order('num DESC')->select();$IIIIIIlI11Il=array();if ($IIIIII1lIII1){foreach ($IIIIII1lIII1 as $IIIIII1Il1I1){$IIIIIlIllIII=strtolower($IIIIII1Il1I1['model']);if (key_exists($IIIIIlIllIII,$IIIIIIlI11Il)){$IIIIIIlI11Il[$IIIIIlIllIII]++;}else {$IIIIIIlI11Il[$IIIIIlIllIII]=1;}}}asort($IIIIIIlI11Il);$IIIIIlIIll11='<chart borderThickness="0" caption="30日内粉丝行为分析" baseFontColor="666666" baseFont="宋体" baseFontSize="14" bgColor="FFFFFF" bgAlpha="0" showBorder="0" bgAngle="360" pieYScale="90"  pieSliceDepth="5" smartLineColor="666666">';if ($IIIIIIlI11Il){foreach ($IIIIIIlI11Il as $IIIIIIIllIll=>$IIIIIIlIllII){$IIIIIlIIll11.='<set label="'.$this->IIIIII1I111I[$IIIIIIIllIll]['name'].'" value="'.$IIIIIIlIllII.'"/>';}}$IIIIIlIIll11.='</chart>';$this->assign('items',$IIIIII1lIII1);$this->assign('xml',$IIIIIlIIll11);break;}$this->display();}}

?>