예제 #1
0
 /**
  * 用户抽奖活动统计页面
  */
 public function UserLotteryInfoAction()
 {
     $data = reqstr('data');
     // if (!$data) {
     // 	return;
     // }
     $page = reqnum('page', 1);
     $pagesize = 10;
     $data = urldecode($data);
     $info = array();
     parse_str($data, $info);
     $date = (int) $info['date'] ? (int) $info['date'] : 7;
     //默认是查出7天的数据
     $sdate = trim($info['sdate']) ? trim($info['sdate']) : '';
     $edate = trim($info['edate']) ? trim($info['edate']) : '';
     $station = (int) $info['station'] ? (int) $info['station'] : 0;
     // 0 表示查询出所有车站
     $hour = trim($info['time']) ? trim($info['time']) : '';
     $type = trim($info['type']) ? trim($info['type']) : 'pv';
     //默认是游戏
     if (!$sdate && !$edate) {
         $edate = date('Y-m-d');
         $sdate = date('Y-m-d', strtotime("-{$date} day"));
     }
     if (!$sdate || !$edate) {
         if ($sdate) {
             $edate = $sdate;
         } else {
             $sdate = $edate;
         }
     }
     $sdate = str_replace('-', '_', $sdate);
     $edate = str_replace('-', '_', $edate);
     $nt = new Psys_ResourceModel();
     $action = array('alertclose' => 'alertclose', 'alertdraw' => 'alertdraw', 'redpacket' => 'redpacket', 'activity' => 'activity', 'message' => 'message', 'question' => 'question', 'lottery' => 'lottery');
     $res_tab = array();
     $res_grap = array();
     $allowstation = array(1, 2);
     foreach ($action as $k => $v) {
         $data_tab[$k] = $nt->UserActivity($v, $page, $pagesize, $sdate, $edate, $station, $hour, $type);
         $data_grap[$k] = $nt->UserActivity($v, $page, $pagesize, $sdate, $edate, $station, $hour, $type, 1);
         if ($data_tab[$k]['allrow']) {
             if (in_array($station, $allowstation)) {
                 $res_tab[$k] = $data_tab[$k]['allrow'] * 2;
             } else {
                 $res_tab[$k] = $data_tab[$k]['allrow'] * 4;
             }
         } else {
             $res_tab[$k] = 0;
         }
         if ($data_grap[$k]['allrow']) {
             if (in_array($station, $allowstation)) {
                 array_push($res_grap, (int) $data_grap[$k]['allrow'] * 2);
             } else {
                 array_push($res_grap, (int) $data_grap[$k]['allrow'] * 4);
             }
         } else {
             array_push($res_grap, 0);
         }
     }
     $result['x_cat'] = array('关闭弹窗', '弹窗抽奖', '红包点击', '活动页面', '短信发送', '问卷调查', '抽奖统计');
     $datas[0]['name'] = '用户抽奖活动流程';
     $datas[0]['data'] = $res_grap;
     $result['table'] = $res_tab;
     $result['y_data'] = $datas;
     return $result;
 }