Example #1
0
 /**
  * 下载详情
  * 
  */
 public function downappinfoAction()
 {
     $data = reqstr('data');
     $appid = reqnum('appid', 12);
     if (!$appid) {
         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 = (int) $info['station'] ? (int) $info['station'] : 0;
     // 0 表示查询出所有车站
     if (!$sdate || !$edate) {
         $edate = date('Y-m-d', strtotime("-1 day"));
         $sdate = date('Y-m-d', strtotime("-{$date} day"));
     }
     $sdate = str_replace('-', '_', $sdate);
     $edate = str_replace('-', '_', $edate);
     $nt = new Psys_ResourceModel();
     $data = $nt->DwonAppInfo($appid, $station, $sdate, $edate);
     foreach ($data['allrow'] as $v) {
         $x_date = $result['x_cat'][] = date('m/d', strtotime(str_replace('_', '-', $v['date'])));
         $datas[0]['name'] = $v['appname'];
         $eventrecordinfo = $nt->EventRecordInfo($v['date'], $v['type'], $v['stationid']);
         //返回特殊点的提示信息
         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;
         if (empty($eventrecordinfo)) {
             $datas[0]['data'][] = (int) $v['num'];
         } else {
             $datas[0]['data'][] = array('y' => (int) $v['num'], 'marker' => array('fillColor' => '#FF0000', 'lineColor' => '#FF0000', 'states' => array('hover' => array('fillColor' => '#FF0000', 'lineColor' => '#FF0000'))));
             //设置当前点鼠标经过的颜色
         }
     }
     $result['y_data'] = $datas;
     $stations = $nt->station();
     if ($station) {
         $stationname = $this->getstationname($stations, $station);
     } else {
         $stationname = ' 所有车站 ';
     }
     $result['title'] = $result['x_cat'][0] . '-' . end($result['x_cat']) . $stationname . '下载趋势图';
     return $result;
 }