Commit 0b16b7b1 authored by yinxiaoling's avatar yinxiaoling

下载失败数据

parent 7d97a651
......@@ -156,7 +156,7 @@ class StrategySetController extends Controller
if (empty($excelFile)){
return $this->errorWithInfo('表单验证失败', 401);
}
$url = storage_path()."/import/".$excelFile.'.xlsx';
$url = storage_path()."/import/".$excelFile.'.xlsx';//dump(file_exists($url));dd($url);
try{
if (file_exists($url) == false){
return $this->errorWithInfo('文件不存在,下载失败', 401);
......@@ -166,7 +166,7 @@ class StrategySetController extends Controller
fclose($cont);
//发送mp3文件MIME 头
header('Content-Type:application/vnd.ms-excel');
header('Content-Type:application/vnd.ms-excel;charset=utf-8;');
// 发送下载附件头.
header("Content-disposition: attachment; filename=\"".$url."\"");
header('Content-transfer-encoding: binary');
......
......@@ -17,9 +17,11 @@ class StrategyTaskController extends Controller
public function index(Request $request){
try{
$pageSize=request()->pageSize;
$pageSize = $request->pageSize;
if (empty($pageSize)){
$pageSize = 20;
}
$projectArr = $this->getAllowProjects(1);
//$strategyInfo = StrategyTask::all()->toArray();
$searchArr = [];
/* $searchArr['phone'] = request()->phone;
......@@ -32,9 +34,7 @@ class StrategyTaskController extends Controller
$searchArr['callTimeStart'] = $request->started_at;
$searchArr['callTimeStop'] = $request->stoped_at;
Log::channel('api')->info(var_export($searchArr,true));
//Log::channel('api')->info(var_export($searchArr,true));
$strategyInfo = StrategyTask::where(function($query) use ($searchArr){
if (isset($searchArr['phone']) && !empty($searchArr['phone'])){
......
......@@ -104,8 +104,7 @@ class StrategyService
if ($failTotal > 0){//把导出错误数据存入excel表格中供下载
$failDataTitle = ['姓名','*手机号码','值班日期','失败原因'];
array_unshift($failData, $failDataTitle);
$failExcelName = "导入失败数据_".date('YmdHis');
$failExcelName = "importfaildata_".date('YmdHis');
$failFile = $this->storeExcelStyle($failExcelName, $failData,'','import');
//$failDataFile = $failExcelName.'.xlsx';
if ($failFile){
......@@ -130,7 +129,7 @@ class StrategyService
}
}
$e = Excel::create(iconv('UTF-8', 'GBK', $excelName),function($excel) use ($datas,$arr){
$e = Excel::create(iconv('UTF-8', 'GB2312', $excelName),function($excel) use ($datas,$arr){
$excel->sheet('score', function($sheet) use ($datas,$arr){
$col =array();
$sheet->rows($datas);
......
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