问题
一个表单中添加两个excel文件;提交,controller中分别分发一个到high队列;另一个到low中;
因为两个excel文件格式并不是相同的,所以在队列任务中添加了不同的config:
第一个文件(high)
$file='xxx';
config(['excel.import.startRow' => 2 ]);
config(['excel.import.dates.columns' => [
'delivery_date'
]]);
Excel::selectSheetsByIndex(1)->filter('chunk')->load($file)>chunk(2000,function($result) {
//写入库
},'high');
第二个文件(low)
$file='xxx';
config(['excel.import.startRow' => 6 ]);
config(['excel.import.heading' => 'numeric' ]);
Excel::selectSheetsByIndex(0)->filter('chunk')->load($file)>chunk(1000,function($result) {
//写入库
},'low');
结果
第一个文件顺利正确的导入;第二个导入失败;队列正常执行;
原因
第二个文件导入的时候加载的config文件是第一个文件的;第二个文件只有一个sheet;我尝试打印,第二个队列中读出来数据是空的;
问题:
如何解决让第二个队列导入的时候加载是自己设置的config?
最后
谢谢大佬!