/** * 伙伴推广页面 */ public function spreadtrainappAction() { $nt = new Psys_StationModel(); $stations = $nt->station(); $this->smarty->assign('stations', $stations); $this->forward = "spreadtrainapp"; }
/** * 所选时间段范围内的每7天WiFi连接数与注册数 */ public function wifidataweekAction() { $data = reqstr('data'); if (!$data) { return; } $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 = empty($info['station']) ? 1 : implode(',', $info['station']); if (!$sdate || !$edate) { $edate = date('Y-m-d'); $sdate = date('Y-m-d', strtotime("-{$date} day")); } if ($sdate < '2015-02-01') { $sdate = '2015-02-01'; } $isbaifenbi = reqnum('baifenbi', 0); $dates = $this->cutdate($sdate, $edate); $nt = new Psys_StationModel(); foreach ($dates as $v_date) { $res[] = $nt->wifidataweek($station, $v_date['sdate'], $v_date['edate']); } $datas[0]['name'] = 'wifi连接数'; $datas[1]['name'] = '注册数'; foreach ($res as $v) { $result['x_cat'][] = $v['datearea']; $datas[0]['data'][] = (int) $v['wifi']; $datas[1]['data'][] = (int) $v['reg']; if ($isbaifenbi) { $baifenbis[0]['name'] = '周注册连接百分比'; $b = $v['reg'] / $v['wifi'] * 100; $baifenbis[0]['data'][] = (double) round($b, 2); } } $result['y_data'] = $datas; if ($isbaifenbi) { $result['baifenbi'] = $baifenbis; } return $result; }
/** * 手机品牌、浏览器、系统排行页面 */ 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); }