Kaynağa Gözat

每刻 接口增加参数

cqp 4 ay önce
ebeveyn
işleme
0b1232a82f
1 değiştirilmiş dosya ile 9 ekleme ve 1 silme
  1. 9 1
      app/Service/ImportService.php

+ 9 - 1
app/Service/ImportService.php

@@ -31,9 +31,11 @@ class ImportService extends Service
 
     const file_one = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
     const file_two = 'application/zip';
+    const file_three = 'application/octet-stream';
     const file_array = [
         self::file_one,
         self::file_two,
+        self::file_three,
     ];
 
     //文件类型
@@ -214,7 +216,13 @@ class ImportService extends Service
             unlink($tempFile);
 
             return [true, ["content" => $allFilesData, 'type' => 'zip']];
-        } else {
+        } elseif ($mimeType === self::file_three){
+            // 处理单个XLSX文件
+            list($status,$result) = $this->processXlsxFile($tempFile);
+            if (! $status) return [false, $result];
+
+            return [true, ['content' => [$result], 'type' => 'xlsx']];
+        }else {
             // 删除临时文件
             unlink($tempFile);
             return [false, '不支持的文件类型'];