Commit fdc5adc3 by 杨昕

多个sheet 默认处理有数据的第一个sheet

parent 97ec5572
Pipeline #14121 passed with stages
in 3 minutes 20 seconds
......@@ -284,11 +284,20 @@ class MediaController extends Controller
#将文件内容转化为数组
$sheet = (new MediasImport())->toArray($file);
$orginal_data = null;
foreach ($sheet as $k => $v){
if (!empty($v)){
$orginal_data = $v;
break;
}
}
if (empty($orginal_data)){
throw new \Exception("文件格式有误");
}
$temp = [];
foreach ($sheet[0] as $key => $item){
foreach ($orginal_data as $key => $item){
if (!isset($item["媒资编号"]) || !isset($item["名称"])){
throw new \Exception("文件格式有误");
......@@ -301,7 +310,7 @@ class MediaController extends Controller
}
$data = [];
if (!empty($sheet[0])){
if (!empty($orginal_data)){
#批量获取永久播放链接地址
$mediaInfos = MediaModel::batchGetMediaForverM3u8($request,$temp);
......
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