|
@@ -346,6 +346,17 @@ class Send_sms_adminAction extends Action
|
|
if(!empty($tel)) {
|
|
if(!empty($tel)) {
|
|
$where.=" and (mobile='$tel' or from_phone ='$tel' )";
|
|
$where.=" and (mobile='$tel' or from_phone ='$tel' )";
|
|
}
|
|
}
|
|
|
|
+ $starttime = trim($_REQUEST['starttime']);
|
|
|
|
+ if(!empty($starttime)) {
|
|
|
|
+ $starttimes=strtotime($starttime);
|
|
|
|
+ $where.=" and UNIX_TIMESTAMP(receive_time) >'{$starttimes}'";
|
|
|
|
+ }
|
|
|
|
+ $endtime = trim($_REQUEST['endtime']);
|
|
|
|
+ if(!empty($endtime)) {
|
|
|
|
+ $endtimes=strtotime($endtime);
|
|
|
|
+ $where.=" and UNIX_TIMESTAMP(receive_time) <'{$endtimes}'";
|
|
|
|
+ }
|
|
|
|
+
|
|
$list = $admin->select_smsdidlog_list($where,$limit);
|
|
$list = $admin->select_smsdidlog_list($where,$limit);
|
|
|
|
|
|
$all_total = $admin->select_smsdidlog_count($where);
|
|
$all_total = $admin->select_smsdidlog_count($where);
|
|
@@ -361,6 +372,8 @@ class Send_sms_adminAction extends Action
|
|
$new[$k]['uname']=$this->getName($admin,$v['uid']);
|
|
$new[$k]['uname']=$this->getName($admin,$v['uid']);
|
|
}
|
|
}
|
|
$this->assign('tel',$tel);
|
|
$this->assign('tel',$tel);
|
|
|
|
+ $this->assign('starttime',$starttime);
|
|
|
|
+ $this->assign('endtime',$endtime);
|
|
$this->assign('status_array',$status_array);
|
|
$this->assign('status_array',$status_array);
|
|
$this->assign('info',$info);
|
|
$this->assign('info',$info);
|
|
$this->assign('error',$error);
|
|
$this->assign('error',$error);
|
|
@@ -370,6 +383,109 @@ class Send_sms_adminAction extends Action
|
|
$this->assign('uname',$uname);
|
|
$this->assign('uname',$uname);
|
|
$this->display('didquery.html');
|
|
$this->display('didquery.html');
|
|
}
|
|
}
|
|
|
|
+ public function export(){
|
|
|
|
+ $admin = new AdvertAdminAction();
|
|
|
|
+ $where = "where 1=1 ";
|
|
|
|
+ $starttime = trim($_REQUEST['starttime']);
|
|
|
|
+ if(!empty($starttime)) {
|
|
|
|
+ $starttimes=strtotime($starttime);
|
|
|
|
+ $where.=" and UNIX_TIMESTAMP(receive_time) >'{$starttimes}'";
|
|
|
|
+ }
|
|
|
|
+ $endtime = trim($_REQUEST['endtime']);
|
|
|
|
+ if(!empty($endtime)) {
|
|
|
|
+ $endtimes=strtotime($endtime);
|
|
|
|
+ $where.=" and UNIX_TIMESTAMP(receive_time) <'{$endtimes}'";
|
|
|
|
+ }
|
|
|
|
+ $list = $admin->select_smsdidlog_list($where);
|
|
|
|
+ $new=array();
|
|
|
|
+ foreach ($list as $k=>$v){
|
|
|
|
+ $new[$k]=$v;
|
|
|
|
+ $new[$k]['uname']=$this->getName($admin,$v['uid']);
|
|
|
|
+ }
|
|
|
|
+ $d = date('Y-m-d',time());
|
|
|
|
+ $this->generateEXCEL($d."导出取消订阅客户数据",$new);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function generateEXCEL($filename = 'report',$data = ''){
|
|
|
|
+
|
|
|
|
+ //引入PHPExcel相关文件
|
|
|
|
+ require_once( ONU_ROOT . 'phpexcel/PHPExcel.php');
|
|
|
|
+ require_once( ONU_ROOT . 'phpexcel/PHPExcel/IOFactory.php');
|
|
|
|
+ require_once( ONU_ROOT . 'phpexcel/PHPExcel/Writer/Excel5.php');
|
|
|
|
+
|
|
|
|
+ //新建
|
|
|
|
+ $resultPHPExcel = new PHPExcel();
|
|
|
|
+ //设置参数
|
|
|
|
+
|
|
|
|
+ //设值
|
|
|
|
+ $resultPHPExcel->getActiveSheet()->setCellValue('A1', '站点');
|
|
|
|
+ $resultPHPExcel->getActiveSheet()->setCellValue('B1', 'mobile');
|
|
|
|
+ //设置水平居中
|
|
|
|
+ $resultPHPExcel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
|
|
|
+ $resultPHPExcel->getActiveSheet()->getStyle('B1')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
|
|
|
+
|
|
|
|
+ //设置水平居中
|
|
|
|
+ $resultPHPExcel->getActiveSheet()->getStyle('A')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
|
|
|
+ $resultPHPExcel->getActiveSheet()->getStyle('B')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ $i = 2;
|
|
|
|
+ foreach($data as $item){
|
|
|
|
+ $resultPHPExcel->getActiveSheet()->setCellValue('A' . $i, $item['uname']);
|
|
|
|
+ $resultPHPExcel->getActiveSheet()->setCellValue('B' . $i, $item['mobile']);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //设置单元格宽度
|
|
|
|
+ $resultPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(40);
|
|
|
|
+ $resultPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(30);
|
|
|
|
+ $resultPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(30);
|
|
|
|
+ $resultPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(30);
|
|
|
|
+
|
|
|
|
+ //设置水平居中
|
|
|
|
+ $resultPHPExcel->getActiveSheet()->getStyle('A')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
|
|
|
+ $resultPHPExcel->getActiveSheet()->getStyle('B')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //设置行高度
|
|
|
|
+ $resultPHPExcel->getActiveSheet()->getRowDimension("1")->setRowHeight(20);
|
|
|
|
+ $resultPHPExcel->getActiveSheet()->getRowDimension($i)->setRowHeight(20);
|
|
|
|
+
|
|
|
|
+ $i ++;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //设置导出文件名
|
|
|
|
+ $xlsWriter = new PHPExcel_Writer_Excel5($resultPHPExcel);
|
|
|
|
+
|
|
|
|
+ ob_end_clean();//清除缓冲区,避免乱码
|
|
|
|
+
|
|
|
|
+ //ob_start(); ob_flush();
|
|
|
|
+ header("Content-Type: application/vnd.ms-excel; charset=UTF-8");
|
|
|
|
+
|
|
|
|
+ header("Content-Type: application/force-download");
|
|
|
|
+
|
|
|
|
+ header("Content-Type: application/octet-stream");
|
|
|
|
+
|
|
|
|
+ header("Content-Type: application/download");
|
|
|
|
+
|
|
|
|
+ //header('Content-Disposition:inline;filename="'.$outputFileName.'"');
|
|
|
|
+ header('Content-Disposition:attachment;filename='.'"'.$filename.'.xls"'); //可以对文件名进行处理
|
|
|
|
+
|
|
|
|
+ header("Content-Transfer-Encoding: binary");
|
|
|
|
+
|
|
|
|
+ header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
|
|
|
+
|
|
|
|
+ header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
|
|
|
+
|
|
|
|
+ header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
|
|
|
|
+
|
|
|
|
+ header("Pragma: no-cache");
|
|
|
|
+
|
|
|
|
+ $xlsWriter->save('php://output');
|
|
|
|
+
|
|
|
|
+ exit;
|
|
|
|
+ }
|
|
public function getName($admin,$uid){
|
|
public function getName($admin,$uid){
|
|
$result = $admin->selectUserName($uid);
|
|
$result = $admin->selectUserName($uid);
|
|
return $result['uname'];
|
|
return $result['uname'];
|