示例#1
0
 /**
  * 流程导出功能
  */
 public function webcountexportAction()
 {
     $stationid = reqnum('stationid', 1);
     $model = new Psys_StationModel();
     $stationname = $model->GetOne(array('id' => $stationid), 'stationname', 'rha_station');
     $data = $model->webcountexport($stationid, $page, $pagesize);
     $databody = array();
     foreach ($data as $k => $v) {
         $databody[$k][] = $v['date'];
         $databody[$k][] = $v['link'];
         $databody[$k][] = $v['ad'];
         $databody[$k][] = $v['reg'];
         $databody[$k][] = $v['login'];
         $databody[$k][] = $v['sindex'];
     }
     $header = array('日期', 'WIFI连接', '广告页1/uv', '注册页/uv', '注册成功数/uv', '首页/uv');
     require COMMON_PATH . 'XExportExcel.php';
     $excel = new Excel();
     $excel->addHeader($header);
     $excel->addBody($databody);
     $excel->downLoad($stationname['stationname']);
 }
示例#2
0
    public function downLoad($filename = '')
    {
        if (!$filename) {
            $filename = date('YmdHis', time()) . '.xls';
        }
        header("Content-type:application/vnd.ms-excel");
        header("Content-Disposition:attachment;filename={$filename}");
        header("Content-Type:charset=utf-8");
        if ($this->head) {
            echo $this->head;
        }
        echo $this->body;
    }
    public function charset($string)
    {
        return mb_convert_encoding($string, 'utf-8', 'auto');
    }
}
$excel = new Excel();
$excel->addHeader(array('title', 'source', 'pubtime', 'writer', 'body'));
global $dsql;
$sql = "select dede_archives.title,dede_archives.source,dede_archives.pubdate,dede_archives.writer,dede_addonarticle.body from dede_archives,dede_addonarticle where dede_addonarticle.aid=dede_archives.id";
$dsql->SetQuery($sql);
$dsql->Execute();
while ($row = $dsql->GetArray()) {
    $row[body] = base64_encode($row[body]);
    $list[] = $row;
}
unset($row);
$excel->addBody($list);
$excel->downLoad();
示例#3
0
 /**
  * 导出电话号码到excel
  */
 public function exportphoneAction()
 {
     $sdate = reqstr('sdate');
     $edate = reqstr('edate');
     $carid = reqstr('carid');
     if (!$sdate || !$edate || !$carid) {
         return array('status' => 0, 'msg' => '非法操作');
     }
     $where['date_>='] = $sdate;
     $where['date_<='] = $edate;
     $where['carid'] = $carid;
     $obj = new PSys_BusModel();
     $obj->SetDb('bus_db');
     $res = $obj->GetList($where, '', 0, 0, 'date,phone,gonettime', 'rb_gonet_time');
     $carname = $this->GetBusName($carid, 'bus');
     if (empty($res['allrow'])) {
         return array('status' => 0, 'msg' => '没有数据');
     }
     foreach ($res['allrow'] as &$v) {
         array_push($v, $carname);
         $v = array_values($v);
     }
     $result['table_title'] = array('日期', '手机号', '获取验证码到成功上网的时间', '汽车');
     $result['table_data'] = $res['allrow'];
     require COMMON_PATH . 'XExportExcel.php';
     $excel = new Excel();
     $excel->addHeader($result['table_title']);
     $excel->addBody($result['table_data']);
     $excel->downLoad($carname . '手机号');
 }
 /**
  * 导出保单流程数据
  */
 public function exportbddataAction()
 {
     $data = reqstr('data');
     $data = urldecode($data);
     $info = array();
     parse_str($data, $info);
     $sdate = reqstr('sdate', '');
     $edate = reqstr('edate', '');
     if (!$sdate || !$edate) {
         if (!$sdate) {
             $sdate = date('Y-m-d', strtotime('-1 day'));
         }
         $edate = $sdate;
     }
     if ($edate < $sdate) {
         return array('status' => 0, 'msg' => '时间区间选择有误');
     }
     $stationids = reqstr('stationid', '');
     $stationids = rtrim($stationids, ',');
     $where['cday_>='] = $sdate;
     $where['cday_<='] = $edate;
     $where['station_id_IN'] = $stationids;
     $where['type'] = 4;
     $fild = 'cday,station_id,connect_wifi,ad1_page,register_page,send_sms_success,register_success,free_wifi_click,sindex';
     $res = $this->obj->GetList($where, 'station_id ASC', 0, 0, $fild, 'rha_allprocess');
     //表格数据展示
     $result['table_title'] = array('日期', '车站', '连接数', '广告1', '人寿保单注册页', '短信发送成功', '保单领取成功', '点击上网人数', '首页');
     foreach ($res['allrow'] as $key => &$val) {
         $val['station_id'] = $this->obj->GetStationName($val['station_id']);
         $val = array_values($val);
     }
     $table_data = $res['allrow'];
     $isexport = reqnum('isexport', 0);
     if ($isexport) {
         require COMMON_PATH . 'XExportExcel.php';
         $excel = new Excel();
         $excel->addHeader($result['table_title']);
         $excel->addBody($table_data);
         $excel->downLoad('人寿保单注册流程');
     }
 }