getSelection(); $inventoryCompares=app('InventoryCompareService')->getInventoryCompare($request->all()); $param = $request->input(); return view('inventory.statement.inventoryCompare',compact('owners','inventoryCompares','param')); } function importExcel(Request $request){ if (!Gate::allows('库存管理-库存-库存对比')){return redirect(url('/')); } // $owner_id=$request->owner_id; // if(!$owner_id) return '

导入Excel失败

您还未选择相应货主!

'; $fileSuffix = $request->file()['file']->getClientOriginalExtension(); if (in_array($fileSuffix, ['xlsx', 'xlsm', 'xltx', 'xltm', 'xls', 'xlt', 'ods', 'ots', 'slk', 'xml', 'gnumeric', 'htm', 'html', 'csv', 'tsv'])) { ini_set('max_execution_time', 2100); ini_set('memory_limit', '512M'); $extension = $request->file()['file']->getClientOriginalExtension(); $extension[0] = strtoupper($extension[0]); Excel::import(new InventoryCompareImport(), $request->file('file')->path(), null, $extension); if (Cache::has('error')) { return '

导入Excel失败

' . Cache::pull('error') . '

'; } else { $exception = Cache::get('exception'); if ($exception){ $a = ''; for ($i = 0; $i < count($exception); $i++) { $a .= implode(',', $exception[$i]) . ' '; }; $this->log(__METHOD__, __FUNCTION__, json_encode($request->toArray()), Auth::user()['id']); return '

导入Excel失败

'; }else { return '

导入Excel成功

'; } } } else { return '

失败

不支持该文件类型

'; } } }