This commit is contained in:
wangjinlei
2022-12-21 18:41:13 +08:00
parent e05a3d163a
commit 28553a3cd0
3 changed files with 275 additions and 5 deletions

View File

@@ -211,6 +211,45 @@ class Super extends Controller{
$re['np'] = $np;
return $re;
}
// public function company(){
// $file = "d://company.xlsx";
// $res = $this->readExcel($file);
// $frag = [];
// foreach($res as $v){
// $ca['title'] = trim($v);
// $ca['ctime'] = time();
// $ca['state'] = 0;
// $frag[] = $ca;
// }
// Db::name('company_top')->insertAll($frag);
// }
private function readExcel($path)
{
$extension = substr($path, strrpos($path, '.') + 1);
vendor("PHPExcel.PHPExcel");
if ($extension == 'xlsx') {
$objReader = new \PHPExcel_Reader_Excel2007();
$objPHPExcel = $objReader->load($path);
} else if ($extension == 'xls') {
$objReader = new \PHPExcel_Reader_Excel5();
$objPHPExcel = $objReader->load($path);
}
$sheet = $objPHPExcel->getSheet(0);
$highestRow = $sheet->getHighestRow();
$frag = [];
for ($i = 3; $i <= $highestRow; $i++) {
// $aa['username'] = $objPHPExcel->getActiveSheet()->getCell("A" . $i)->getValue();
// $aa['has'] = '未出证';
// if($aa['username']==''){
// continue;
// }
$aa = $objPHPExcel->getActiveSheet()->getCell("B" . $i)->getValue();
$frag[] = $aa;
}
return $frag;
}
public function mutest(){
$start_time = strtotime('2021-01-01');