UpgradeProjectCount.php 1.2 KB
<?php
/**
 * @remark :
 * @name   :UpgradeProjectCount.php
 * @author :lyh
 * @method :post
 * @time   :2024/1/8 9:03
 */

namespace App\Console\Commands\DayCount;

use App\Models\Visit\Visit;
use App\Services\ProjectServer;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;

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

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '升级项目统计';

    public function handle(){
        ProjectServer::useProject(439);
        $this->count();
        DB::disconnect('custom_mysql');
    }

    /**
     * @remark :日统计记录
     * @name   :count
     * @author :lyh
     * @method :post
     * @time   :2024/1/8 9:05
     */
    public function count(){
        $list = DB::connection('custom_mysql')->table('gl_customer_visit')->select('updated_date')
            ->groupBy('updated_date')->get()->toArray();
        if(!empty($list)){
            echo date('Y-m-d H:i:s') . '时间:'.json_encode($list) . PHP_EOL;
        }
        echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
    }
}