示例#1
0
 /**
  * 伙伴推广页面
  */
 public function spreadtrainappAction()
 {
     $nt = new Psys_StationModel();
     $stations = $nt->station();
     $this->smarty->assign('stations', $stations);
     $this->forward = "spreadtrainapp";
 }
示例#2
0
 /**
  * 用户活跃数据
  */
 public function useractiveAction()
 {
     $nt = new Psys_StationModel();
     $stations = $nt->station();
     $this->smarty->assign('stations', $stations);
     $this->forward = 'useractive';
 }
示例#3
0
 /**
  * 手机品牌、浏览器、系统排行页面
  */
 public function mobilerankAction()
 {
     $nt = new Psys_StationModel();
     $stations = $nt->station();
     $this->smarty->assign('stations', $stations);
     $this->forward = 'mobilerank';
 }
 /**
  * 广告展示详情
  */
 public function showadpvinfoAction()
 {
     $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 表示查询出所有车站
     $adtype = trim($info['adtype']) ? trim($info['adtype']) : 'ad';
     //默认是广告1
     if (!$sdate || !$edate) {
         $edate = date('Y-m-d');
         $sdate = date('Y-m-d', strtotime("-{$date} day"));
     }
     //如果时间区间大于30天则按照30天计算
     $date_area = abs(strtotime($edate) - strtotime($sdate)) / 86400;
     if ($date_area > 30) {
         $sdate = date('Y-m-d', strtotime("-30 day"));
     }
     $sdate = str_replace('-', '_', $sdate);
     $edate = str_replace('-', '_', $edate);
     $nt = new Psys_StationModel();
     $data = $nt->ShowAdPvInfo($sdate, $edate, $station, $adtype, $page, $pagesize);
     $graphdata = $nt->ShowAdPvInfo($sdate, $edate, $station, $adtype, $page, $pagesize, 1);
     $paging = $this->paging($data['allnum'], $page, $pagesize, count($data['allrow']));
     /*------------------------------数据格式---------------------------------------------*/
     foreach ($data['allrow'] as $k => &$v) {
         $v['adname'] = $nt->GetAdName($v['detail'])['adname'];
     }
     $nts = new Psys_ResourceModel();
     foreach ($graphdata['allrow'] as $v1) {
         $adinfo = $nt->GetAdName($v1['detail']);
         $x_date = $x_cat[] = date('m/d', strtotime(str_replace('_', '-', $v1['date'])));
         $eventrecordinfo = $nts->EventRecordInfo($v1['date'], 5, $station);
         //返回特殊点的提示信息
         if (!empty($eventrecordinfo)) {
             $title = $eventrecordinfo['title'];
             $descript = $eventrecordinfo['descript'];
         } else {
             $title = '';
             $descript = '';
         }
         $datas[$adinfo['id']]['infos']['date' . $x_date]['title'] = $title;
         $datas[$adinfo['id']]['infos']['date' . $x_date]['descript'] = $descript;
         if (empty($eventrecordinfo)) {
             $datas[$adinfo['id']]['data'][] = (int) $v1['num'];
         } else {
             $datas[$adinfo['id']]['data'][] = array('y' => (int) $v1['num'], 'marker' => array('fillColor' => '#FF0000', 'lineColor' => '#FF0000', 'states' => array('hover' => array('fillColor' => '#FF0000', 'lineColor' => '#FF0000'))));
             //设置当前点鼠标经过的颜色
         }
         $datas[$adinfo['id']]['name'] = $adinfo['adname'];
     }
     /*------------------------------chart数据格式需要索引从0开始---------------------------------------------*/
     $j = 0;
     foreach (array_unique($x_cat) as $v_x) {
         $result['x_cat'][$j] = $v_x;
         $j++;
     }
     $i = 0;
     foreach ($datas as $val) {
         $datass[$i] = $val;
         if ($i > 0) {
             $datass[$i]['visible'] = false;
         }
         $i++;
     }
     $result['y_cat'] = $datass;
     $stations = $nt->station();
     if ($station) {
         $stationname = $this->getstationname($stations, $station);
     } else {
         $stationname = '所有车站';
     }
     return array('table' => $data['allrow'], 'graph' => $result, 'paging' => $paging, 'station' => $stationname);
 }