<?php

namespace App\Console\Commands\Test;

use App\Helper\Arr;
use App\Models\Collect\CollectTask;
use App\Models\Com\UpdateLog;
use App\Models\Com\UpdateVisit;
use App\Models\Product\Product;
use App\Services\ProjectServer;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;

class Temp extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'test_temp';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '临时脚本';


    public function handle()
    {
        $project = ProjectServer::useProject(626);
        if ($project) {
            CollectTask::select(['id', 'language'])->where('status', 0)->chunk(1000, function ($query) {

                foreach ($query as $item) {
                    $item->domain = 'lecusostreetlight.quanqiusou.cn/' . $item->language;
                    $item->save();
                }
            });
        }
        DB::disconnect('custom_mysql');
        echo '成功' . PHP_EOL;
    }
}