<?php

namespace App\Console\Commands\MeiTu;

use App\Jobs\PartnerCommitJob;
use App\Models\Partner\PartnerBeauty;
use Illuminate\Console\Command;

class CommitCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'meitu:commit';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '图片优化替换';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $partners = PartnerBeauty::where('is_beauty', 2)
            ->where('submitted_at', 0)
            ->pluck('id');

        foreach ($partners as $id) {
            dump($id);
            PartnerCommitJob::dispatch($id)->onQueue("{meitu:commit}");
        }
    }
}
