1
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user