Skip to content

Commit

Permalink
refactor: #72 use fast-excel instead of laravel excel
Browse files Browse the repository at this point in the history
  • Loading branch information
sinkcup committed Oct 20, 2021
1 parent 52b2a5d commit 8312c85
Show file tree
Hide file tree
Showing 6 changed files with 309 additions and 1,307 deletions.
5 changes: 2 additions & 3 deletions app/Commands/IssueImportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@

use App\Coding\Issue;
use App\Coding\Project;
use App\Imports\IssuesImport;
use LaravelZero\Framework\Commands\Command;
use Maatwebsite\Excel\Facades\Excel;
use Rap2hpoutre\FastExcel\Facades\FastExcel;

class IssueImportCommand extends Command
{
Expand Down Expand Up @@ -51,7 +50,7 @@ public function handle(Issue $codingIssue, Project $codingProject): int
foreach ($result as $item) {
$issueTypes[$item['Name']] = $item;
}
$rows = Excel::toArray(new IssuesImport(), $filePath)[0];
$rows = FastExcel::import($filePath);
foreach ($rows as $row) {
$data = [
'Type' => $issueTypes[$row['事项类型']]['IssueType'],
Expand Down
14 changes: 0 additions & 14 deletions app/Imports/IssuesImport.php

This file was deleted.

6 changes: 2 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,15 @@
"ext-zip": "*",
"illuminate/database": "^8.40",
"illuminate/log": "^8.0",
"illuminate/translation": "^8.64",
"illuminate/validation": "^8.64",
"laravel-fans/confluence": "^0.1.1",
"laravel-zero/framework": "^8.8",
"league/html-to-markdown": "^5.0",
"maatwebsite/excel": "^3.1",
"nesbot/carbon": "^2.53",
"rap2hpoutre/fast-excel": "^3.1",
"sinkcup/laravel-filesystem-cos-updated": "^4.0"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"fakerphp/faker": "^1.16",
"mockery/mockery": "^1.4.3",
"phpmd/phpmd": "^2.10",
"phpunit/phpunit": "^9.5",
Expand Down
Loading

0 comments on commit 8312c85

Please sign in to comment.