作者 刘朕
1 个管道 的构建 通过 耗费 1 秒

导出功能优化

... ... @@ -308,6 +308,47 @@ class OrderController extends AdminBaseController
//导出Excel
$objPHPExcel = new \PHPExcel();
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(25);
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(15);
$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(15);
$objPHPExcel->getActiveSheet()->getColumnDimension('G')->setWidth(15);
$objPHPExcel->getActiveSheet()->getColumnDimension('H')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('I')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('J')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('K')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('L')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('M')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('N')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('O')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('P')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('Q')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('R')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('S')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('T')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('U')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('V')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('W')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('X')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('Y')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('Z')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AA')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AB')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AC')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AD')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AE')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AF')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AG')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AH')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AI')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AJ')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AK')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AL')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AM')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AN')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AO')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AP')->setWidth(20);
//Add some data
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('A1', 'ID')
... ... @@ -318,7 +359,40 @@ class OrderController extends AdminBaseController
->setCellValue('F1', '订单状态')
->setCellValue('G1', '收集状态')
->setCellValue('H1', '发布时间')
->setCellValue('I1', '失效时间');
->setCellValue('I1', '失效时间')
->setCellValue('J1', '订购方式')
->setCellValue('K1', '来源渠道')
->setCellValue('L1', '销售人员')
->setCellValue('M1', '小朋友姓名')
->setCellValue('N1', '小朋友性别')
->setCellValue('O1', '小朋友生日')
->setCellValue('P1', '订购人姓名')
->setCellValue('Q1', '家长身份')
->setCellValue('R1', '其他身份')
->setCellValue('S1', '订购人电话')
->setCellValue('T1', '手机备用电话')
->setCellValue('U1', '座机备用电话')
->setCellValue('V1', '地址')
->setCellValue('W1', '收货地址')
->setCellValue('X1', '详细收货地址')
->setCellValue('Y1', '收货人姓名')
->setCellValue('Z1', '收货人电话')
->setCellValue('AA1', '收货区域')
->setCellValue('AB1', '商品选择')
->setCellValue('AC1', '具体版本')
->setCellValue('AD1', '其他版本')
->setCellValue('AE1', '订购长度')
->setCellValue('AF1', '其他订购长度')
->setCellValue('AG1', '订购起始月')
->setCellValue('AH1', '订购价格')
->setCellValue('AI1', '礼物选择')
->setCellValue('AJ1', '加赠礼物')
->setCellValue('AK1', '加赠礼物名称')
->setCellValue('AL1', '是否适龄')
->setCellValue('AM1', '不适龄备注')
->setCellValue('AN1', '图片')
->setCellValue('AO1', '月龄版升级年份')
->setCellValue('AP1', '备注');
$i = 2;
... ... @@ -342,6 +416,20 @@ class OrderController extends AdminBaseController
->setCellValue('G' . $i, $is_stop)
->setCellValue('H' . $i, date('Y-m-d H:i',$v['create_time']))
->setCellValue('I' . $i, date('Y-m-d H:i',$v['over_time']));
$v['options'] = json_decode($v['options'],true);
foreach ($v['options'] as $ks=>$vs) {
$where = [
'id' => $vs['id']
];
$vs['cell'] = Db::name('OrderOption')->where($where)->value('cell');
if($vs['type'] == 3) {
$objPHPExcel->setActiveSheetIndex(0)
->setCellValueExplicit($vs['cell'] . $i, $vs['user_choose'],\PHPExcel_Cell_DataType::TYPE_STRING);
} else {
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue($vs['cell'] . $i, $vs['user_choose']);
}
}
$i++;
Db::name('Order')->where(['order_sn'=>$v['order_sn']])->update(['is_excel'=>1,'excel_time'=>time()]);
}
... ...
... ... @@ -209,6 +209,16 @@ class MemberController extends AdminBaseController
//导出Excel
$objPHPExcel = new \PHPExcel();
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(25);
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(15);
$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('G')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('H')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('I')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('J')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('K')->setWidth(20);
//Add some data
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('A1', 'ID')
... ... @@ -242,9 +252,9 @@ class MemberController extends AdminBaseController
->setCellValue('F' . $i, $v['parent_status'])
->setCellValue('G' . $i, $is_member)
->setCellValue('H' . $i, $v['channel_name'])
->setCellValue('I' . $i, date('Y-m-d',$v['create_time']))
->setCellValue('I' . $i, date('Y-m-d H:i',$v['create_time']))
->setCellValue('J' . $i, $v['last_login_ip'])
->setCellValue('K' . $i, date('Y-m-d',$v['last_login_time']));
->setCellValue('K' . $i, date('Y-m-d H:i',$v['last_login_time']));
$i++;
Db::name('Member')->where(['id'=>$v['id']])->update(['is_excel'=>1,'update_time'=>time()]);
}
... ...