/** * 页面停留时间详情 */ public function staytimeinfoAction() { $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 表示查询出所有车站 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->StayTimeInfo($sdate, $edate, $station, $page, $pagesize); //分页 $paging = $this->paging($data['allnum'], $page, $pagesize, count($data['allrow'])); $nts = new Psys_ResourceModel(); //所有页面 $datas[0]['name'] = '所有页面'; $datas[1]['name'] = '广告1'; $datas[1]['visible'] = false; $datas[2]['name'] = '注册页面'; $datas[2]['visible'] = false; $datas[3]['name'] = '广告2'; $datas[3]['visible'] = false; $datas[4]['name'] = '首页'; $datas[4]['visible'] = false; $datas[5]['name'] = '车站服务'; $datas[5]['visible'] = false; $datas[6]['name'] = '电影'; $datas[6]['visible'] = false; $datas[7]['name'] = '音乐'; $datas[7]['visible'] = false; $datas[8]['name'] = '游戏'; $datas[8]['visible'] = false; $datas[9]['name'] = '应用'; $datas[9]['visible'] = false; foreach ($data['allrow'] as &$v) { //表格展示数据 $v['date'] = str_replace('_', '-', $v['date']); $v['total'] = (double) round(($v['indexindex'] + $v['indexregister'] + $v['indexwelcome'] + $v['indexsindex'] + $v['stationindex'] + $v['movieindex'] + $v['musicindex'] + $v['gameindex'] + $v['appindex']) / 3600, 2); $v['indexindex'] = (double) round($v['indexindex'] / 3600, 2); $v['indexregister'] = (double) round($v['indexregister'] / 3600, 2); $v['indexwelcome'] = (double) round($v['indexwelcome'] / 3600, 2); $v['indexsindex'] = (double) round($v['indexsindex'] / 3600, 2); $v['stationindex'] = (double) round($v['stationindex'] / 3600, 2); $v['movieindex'] = (double) round($v['movieindex'] / 3600, 2); $v['musicindex'] = (double) round($v['musicindex'] / 3600, 2); $v['gameindex'] = (double) round($v['gameindex'] / 3600, 2); $v['appindex'] = (double) round($v['appindex'] / 3600, 2); /*------------------------------统计图数据-------------------------------*/ $x_date = $result['x_cat'][] = date('m/d', strtotime($v['date'])); $eventrecordinfo = $nts->EventRecordInfo(str_replace('-', '_', $v['date']), 0, $station); //返回特殊点的提示信息 if (!empty($eventrecordinfo)) { $title = $eventrecordinfo['title']; $descript = $eventrecordinfo['descript']; } else { $title = ''; $descript = ''; } $datas[0]['infos']['date' . $x_date]['title'] = $title; $datas[0]['infos']['date' . $x_date]['descript'] = $descript; $datas[1]['infos']['date' . $x_date]['title'] = $title; $datas[1]['infos']['date' . $x_date]['descript'] = $descript; $datas[2]['infos']['date' . $x_date]['title'] = $title; $datas[2]['infos']['date' . $x_date]['descript'] = $descript; $datas[3]['infos']['date' . $x_date]['title'] = $title; $datas[3]['infos']['date' . $x_date]['descript'] = $descript; $datas[4]['infos']['date' . $x_date]['title'] = $title; $datas[4]['infos']['date' . $x_date]['descript'] = $descript; $datas[5]['infos']['date' . $x_date]['title'] = $title; $datas[5]['infos']['date' . $x_date]['descript'] = $descript; $datas[6]['infos']['date' . $x_date]['title'] = $title; $datas[6]['infos']['date' . $x_date]['descript'] = $descript; $datas[7]['infos']['date' . $x_date]['title'] = $title; $datas[7]['infos']['date' . $x_date]['descript'] = $descript; $datas[8]['infos']['date' . $x_date]['title'] = $title; $datas[8]['infos']['date' . $x_date]['descript'] = $descript; $datas[9]['infos']['date' . $x_date]['title'] = $title; $datas[9]['infos']['date' . $x_date]['descript'] = $descript; if (empty($eventrecordinfo)) { $datas[0]['data'][] = (int) $v['total']; $datas[1]['data'][] = (int) $v['indexindex']; $datas[2]['data'][] = (int) $v['indexregister']; $datas[3]['data'][] = (int) $v['indexwelcome']; $datas[4]['data'][] = (int) $v['indexsindex']; $datas[5]['data'][] = (int) $v['stationindex']; $datas[6]['data'][] = (int) $v['movieindex']; $datas[7]['data'][] = (int) $v['musicindex']; $datas[8]['data'][] = (int) $v['gameindex']; $datas[9]['data'][] = (int) $v['appindex']; } else { $datas[0]['data'][] = array('y' => (int) $v['total'], 'marker' => array('fillColor' => '#FF0000', 'lineColor' => '#FF0000', 'states' => array('hover' => array('fillColor' => '#FF0000', 'lineColor' => '#FF0000')))); //设置当前点鼠标经过的颜色 $datas[1]['data'][] = array('y' => (int) $v['indexindex'], 'marker' => array('fillColor' => '#FF0000', 'lineColor' => '#FF0000', 'states' => array('hover' => array('fillColor' => '#FF0000', 'lineColor' => '#FF0000')))); //设置当前点鼠标经过的颜色 $datas[2]['data'][] = array('y' => (int) $v['indexregister'], 'marker' => array('fillColor' => '#FF0000', 'lineColor' => '#FF0000', 'states' => array('hover' => array('fillColor' => '#FF0000', 'lineColor' => '#FF0000')))); //设置当前点鼠标经过的颜色 $datas[3]['data'][] = array('y' => (int) $v['indexwelcome'], 'marker' => array('fillColor' => '#FF0000', 'lineColor' => '#FF0000', 'states' => array('hover' => array('fillColor' => '#FF0000', 'lineColor' => '#FF0000')))); //设置当前点鼠标经过的颜色 $datas[4]['data'][] = array('y' => (int) $v['indexsindex'], 'marker' => array('fillColor' => '#FF0000', 'lineColor' => '#FF0000', 'states' => array('hover' => array('fillColor' => '#FF0000', 'lineColor' => '#FF0000')))); //设置当前点鼠标经过的颜色 $datas[5]['data'][] = array('y' => (int) $v['stationindex'], 'marker' => array('fillColor' => '#FF0000', 'lineColor' => '#FF0000', 'states' => array('hover' => array('fillColor' => '#FF0000', 'lineColor' => '#FF0000')))); //设置当前点鼠标经过的颜色 $datas[6]['data'][] = array('y' => (int) $v['movieindex'], 'marker' => array('fillColor' => '#FF0000', 'lineColor' => '#FF0000', 'states' => array('hover' => array('fillColor' => '#FF0000', 'lineColor' => '#FF0000')))); //设置当前点鼠标经过的颜色 $datas[7]['data'][] = array('y' => (int) $v['musicindex'], 'marker' => array('fillColor' => '#FF0000', 'lineColor' => '#FF0000', 'states' => array('hover' => array('fillColor' => '#FF0000', 'lineColor' => '#FF0000')))); //设置当前点鼠标经过的颜色 $datas[8]['data'][] = array('y' => (int) $v['gameindex'], 'marker' => array('fillColor' => '#FF0000', 'lineColor' => '#FF0000', 'states' => array('hover' => array('fillColor' => '#FF0000', 'lineColor' => '#FF0000')))); //设置当前点鼠标经过的颜色 $datas[9]['data'][] = array('y' => (int) $v['appindex'], 'marker' => array('fillColor' => '#FF0000', 'lineColor' => '#FF0000', 'states' => array('hover' => array('fillColor' => '#FF0000', 'lineColor' => '#FF0000')))); //设置当前点鼠标经过的颜色 } } $result['y_cat'] = $datas; $stations = $nt->station(); if ($station) { $stationname = $this->getstationname($stations, $station); } else { $stationname = '所有车站'; } return array('table' => $data['allrow'], 'graph' => $result, 'paging' => $paging, 'station' => $stationname); }
/** * 页面停留时间详情 */ public function staytimeinfoAction() { $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 表示查询出所有车站 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->StayTimeInfo($sdate, $edate, $station, $page, $pagesize); //分页 $paging = $this->paging($data['allnum'], $page, $pagesize, count($data['allrow'])); $nts = new Psys_ResourceModel(); foreach ($data['allrow'] as &$v) { //表格展示数据 $v['date'] = str_replace('_', '-', $v['date']); $v['total'] = (double) round(($v['indexindex'] + $v['indexregister'] + $v['indexwelcome'] + $v['indexsindex'] + $v['stationindex'] + $v['movieindex'] + $v['musicindex'] + $v['gameindex'] + $v['appindex']) / 3600, 2); $v['indexindex'] = (double) round($v['indexindex'] / 3600, 2); $v['indexregister'] = (double) round($v['indexregister'] / 3600, 2); $v['indexwelcome'] = (double) round($v['indexwelcome'] / 3600, 2); $v['indexsindex'] = (double) round($v['indexsindex'] / 3600, 2); $v['stationindex'] = (double) round($v['stationindex'] / 3600, 2); $v['movieindex'] = (double) round($v['movieindex'] / 3600, 2); $v['musicindex'] = (double) round($v['musicindex'] / 3600, 2); $v['gameindex'] = (double) round($v['gameindex'] / 3600, 2); $v['appindex'] = (double) round($v['appindex'] / 3600, 2); /*------------------------------统计图数据-------------------------------*/ $result['x_cat'][] = date('m/d', strtotime($v['date'])); //所有页面 $datas[0]['name'] = '所有页面'; $datas[0]['data'][] = $v['total']; //广告1 $datas[1]['name'] = '广告1'; $datas[1]['data'][] = $v['indexindex']; $datas[1]['visible'] = false; //注册页面 $datas[2]['name'] = '注册页面'; $datas[2]['data'][] = $v['indexregister']; $datas[2]['visible'] = false; //广告2 $datas[3]['name'] = '广告2'; $datas[3]['data'][] = $v['indexwelcome']; $datas[3]['visible'] = false; //首页 $datas[4]['name'] = '首页'; $datas[4]['data'][] = $v['indexsindex']; $datas[4]['visible'] = false; //车站服务 $datas[5]['name'] = '车站服务'; $datas[5]['data'][] = $v['stationindex']; $datas[5]['visible'] = false; //电影 $datas[6]['name'] = '电影'; $datas[6]['data'][] = $v['movieindex']; $datas[6]['visible'] = false; //音乐 $datas[7]['name'] = '音乐'; $datas[7]['data'][] = $v['musicindex']; $datas[7]['visible'] = false; //游戏 $datas[8]['name'] = '游戏'; $datas[8]['data'][] = $v['gameindex']; $datas[8]['visible'] = false; //应用 $datas[9]['name'] = '应用'; $datas[9]['data'][] = $v['appindex']; $datas[9]['visible'] = false; } $result['y_cat'] = $datas; $stations = $nt->station(); if ($station) { $stationname = $this->getstationname($stations, $station); } else { $stationname = '所有车站'; } return array('table' => $data['allrow'], 'graph' => $result, 'paging' => $paging, 'station' => $stationname); }