Lint
This commit is contained in:
parent
24d65e37c3
commit
abc269d6c4
|
@ -5,11 +5,8 @@ namespace App\Initialize;
|
||||||
use App\Initialize\Actions\ProcessRedisAction;
|
use App\Initialize\Actions\ProcessRedisAction;
|
||||||
use App\Nami\Api\CompleteMemberToRedisJob;
|
use App\Nami\Api\CompleteMemberToRedisJob;
|
||||||
use App\Setting\NamiSettings;
|
use App\Setting\NamiSettings;
|
||||||
use Illuminate\Bus\Batch;
|
|
||||||
use Illuminate\Console\Command;
|
|
||||||
use Illuminate\Support\Facades\Bus;
|
use Illuminate\Support\Facades\Bus;
|
||||||
use Illuminate\Support\Facades\Redis;
|
use Illuminate\Support\Facades\Redis;
|
||||||
use Log;
|
|
||||||
use Lorisleiva\Actions\Concerns\AsAction;
|
use Lorisleiva\Actions\Concerns\AsAction;
|
||||||
use Zoomyboy\LaravelNami\Api;
|
use Zoomyboy\LaravelNami\Api;
|
||||||
use Zoomyboy\LaravelNami\Data\MemberEntry as NamiMemberEntry;
|
use Zoomyboy\LaravelNami\Data\MemberEntry as NamiMemberEntry;
|
||||||
|
@ -23,15 +20,14 @@ class InitializeMembers
|
||||||
|
|
||||||
public function handle(Api $api): void
|
public function handle(Api $api): void
|
||||||
{
|
{
|
||||||
$allMembers = collect([]);
|
|
||||||
Redis::delete('members');
|
Redis::delete('members');
|
||||||
|
|
||||||
$jobs = $api->search([])->map(function (NamiMemberEntry $member) use ($api) {
|
$jobs = $api->search([])->map(function (NamiMemberEntry $member) use ($api) {
|
||||||
return new CompleteMemberToRedisJob($api, $member->groupId, $member->id);
|
return new CompleteMemberToRedisJob($api, $member->groupId, $member->id);
|
||||||
})->toArray();
|
})->toArray();
|
||||||
|
|
||||||
$batch = Bus::batch($jobs)
|
Bus::batch($jobs)
|
||||||
->finally(function (Batch $batch) {
|
->finally(function () {
|
||||||
foreach (Redis::lrange('members', 0, -1) as $data) {
|
foreach (Redis::lrange('members', 0, -1) as $data) {
|
||||||
ProcessRedisAction::dispatch(json_decode($data, true));
|
ProcessRedisAction::dispatch(json_decode($data, true));
|
||||||
}
|
}
|
||||||
|
@ -41,7 +37,7 @@ class InitializeMembers
|
||||||
->dispatch();
|
->dispatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function asCommand(Command $command): int
|
public function asCommand(): int
|
||||||
{
|
{
|
||||||
$this->handle(app(NamiSettings::class)->login());
|
$this->handle(app(NamiSettings::class)->login());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue