Commit 3a7c2dba authored by yinxiaoling's avatar yinxiaoling

失败数据调试

parent 4db70c8d
......@@ -33,15 +33,16 @@ class StrategySetController extends Controller
/* if ($validator->fails()) {
return $this->errorWithInfo('表单验证失败', 401);
} */
if (isset($request->all()['upload'])){ //excel文件上传
$params = $request->all();
if (isset($params['upload'])){ //excel文件上传
$excelData = $StrategyService->validUploadExcel($request,'upload',8388608); //限制最大上传文件8M
if (isset($excelData['code'])){
return $this->errorWithInfo($excelData['msg'], 401);
}
//验证excel数据格式及不合格数据原因
$excelDataValid = $StrategyService->validExcelData($excelData, $request->day_type);
$excelDataValid = $StrategyService->validExcelData($excelData, $params['day_type']);
}
dd($excelData);
dd($excelDataValid);
dd('策略添加');
}
......
......@@ -90,13 +90,21 @@ class StrategyService
$failTotal = count($failData);
$successTotal = count($data);
$failDataFile = '';
if ($failTotal > 0){//把导出错误数据存入excel表格中供下载
$failDataTitle = ['姓名','*手机号码','值班日期','失败原因'];
array_unshift($failData, $failDataTitle);
$failExcelName = "导入失败数据_".date('YmdHis');
$this->storeExcelStyle($failExcelName, $failData);
dump($failExcelName);
$failFile = $this->storeExcelStyle($failExcelName, $failData,'','import');
$failDataFile = storage_path('export').'\\'.$failExcelName.'.xlsx';
if ($failFile){
}else{ //失败数据写入失败
dd('失败数据写入失败');
}
}
return compact('data','failData','failTotal','successTotal');
return compact('data','failData','failTotal','successTotal','failDataFile');
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment