作者 董瑞恩
1 个管道 的构建 通过 耗费 0 秒

interface

@@ -154,6 +154,7 @@ class AdminEquipmentController extends AdminBaseController{ @@ -154,6 +154,7 @@ class AdminEquipmentController extends AdminBaseController{
154 $allRow = $sheet->getHighestRow(); //取得总行数 154 $allRow = $sheet->getHighestRow(); //取得总行数
155 // $testInfo=new TestinfoModel(); 155 // $testInfo=new TestinfoModel();
156 //从第二行开始插入,第一行是列名 156 //从第二行开始插入,第一行是列名
  157 + $Equipment=new EquipmentModel();
157 for ($j = 2; $j <= $allRow; $j++) { 158 for ($j = 2; $j <= $allRow; $j++) {
158 $data=[ 159 $data=[
159 'serial_number'=> $objPHPExcel->getActiveSheet()->getCell("a" . $j)->getValue(), 160 'serial_number'=> $objPHPExcel->getActiveSheet()->getCell("a" . $j)->getValue(),
@@ -170,7 +171,6 @@ class AdminEquipmentController extends AdminBaseController{ @@ -170,7 +171,6 @@ class AdminEquipmentController extends AdminBaseController{
170 echo "第" . $j . "行".$data['name']."的设备已存在!<br/>"; 171 echo "第" . $j . "行".$data['name']."的设备已存在!<br/>";
171 continue; 172 continue;
172 } 173 }
173 - $Equipment=new EquipmentModel();  
174 try{ 174 try{
175 $Equipment->save($data); 175 $Equipment->save($data);
176 echo "第" . $j . "行数据导入成功!<br/>"; 176 echo "第" . $j . "行数据导入成功!<br/>";