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

namespace App\Console\Commands\MonthlyCount;

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

class UpgradeProjectCount extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'upgrade_month_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(DB::raw('DATE_FORMAT(updated_date, "%Y-%m") as month'))
            ->groupBy('month')->get()->toArray();
        echo date('Y-m-d H:i:s') . '数据:'.json_encode($list) . PHP_EOL;
        $project = new Project();
        $projectInfo = $project->read(['id'=>439]);
        echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
    }

    /**
     * @remark :询盘数量
     * @name   :inquiry_num
     * @author :lyh
     * @method :post
     * @time   :2024/1/8 9:24
     */
    public function inquiry_num($day){
        $count = DB::connection('custom_mysql')->table('gl_customer_visit')->whereDate('updated_date', $day)->where('is_inquiry',1)->count();
        return $count;
    }

    /**
     * @name   :(统计pv)pv_num
     * @author :lyh
     * @method :post
     * @time   :2023/6/14 15:40
     */
    public function pv_num($day){
        $pv = DB::connection('custom_mysql')->table('gl_customer_visit_item')->whereDate('updated_date', $day)->count();
        return $pv;
    }

    /**
     * @name   :(统计ip)ip_num
     * @author :lyh
     * @method :post
     * @time   :2023/6/14 15:40
     */
    public function ip_num($day){
        $ip = DB::connection('custom_mysql')->table('gl_customer_visit')->whereDate('updated_date', $day)->count();
        return $ip;
    }



}