lyhDemo.php 1.7 KB
<?php
/**
 * @remark :
 * @name   :lyhDemo.php
 * @author :lyh
 * @method :post
 * @time   :2025/3/24 9:38
 */

namespace App\Console\Commands\LyhTest;

use App\Console\Commands\Domain\DomainInfo;
use App\Models\Com\NoticeLog;
use App\Models\Project\AiBlogTask;
use App\Models\Project\DeployBuild;
use App\Models\Project\OnlineCheck;
use App\Models\Project\Project;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\DB;

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

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '更新路由';

    public function handle(){
       $data = $this->getRandProject();
    }

    public function getRandProject()
    {
        $ids = Project::leftJoin('gl_project_deploy_optimize as b', 'gl_project.id', '=', 'b.project_id')
            ->leftJoin('gl_project_online_check as c', 'gl_project.id', '=', 'c.project_id')
            ->leftJoin('gl_domain_info as d', 'gl_project.id', '=', 'd.project_id')
            ->where('gl_project.type', Project::TYPE_TWO)
            ->where('gl_project.extend_type', 0) // 是否续费是由extend_type字段控制
            ->where('gl_project.delete_status', Project::IS_DEL_FALSE)
            ->where(function ($subQuery) {
                $subQuery->orwhere('c.qa_status', OnlineCheck::STATUS_ONLINE_TRUE)->orwhere('gl_project.is_upgrade', Project::IS_UPGRADE_TRUE);
            })
            ->pluck('gl_project.id')
            ->toArray();
        $project_ids = array_rand($ids, 10);
        return $project_ids;
    }
}