43 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
			
		
		
	
	
			43 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
<?php
 | 
						|
 | 
						|
namespace app\controller\manager;
 | 
						|
 | 
						|
use app\model\VisitLogoModel;
 | 
						|
use think\response\View;
 | 
						|
 | 
						|
class Index extends Base
 | 
						|
{
 | 
						|
    //后台首页
 | 
						|
    public function index(): View
 | 
						|
    {
 | 
						|
        $today = [];
 | 
						|
 | 
						|
        $today[] = ['create_time', '>', strtotime(date('Y-m-d 00:00:00'))];
 | 
						|
        $today[] = ['create_time', '<', strtotime(date('Y-m-d 23:59:59'))];
 | 
						|
 | 
						|
        // 全部
 | 
						|
        $data['total'] = VisitLogoModel::field('id')->count();
 | 
						|
        // 今日全部
 | 
						|
        $data['todayTotal'] = VisitLogoModel::where($today)->field('id')->count();
 | 
						|
 | 
						|
        // 百度全部
 | 
						|
        $data['totalBaidu'] = VisitLogoModel::where('referer', 'like', '%baidu.com%')->field('id')->count();
 | 
						|
        // 360全部
 | 
						|
        $data['total360'] = VisitLogoModel::where('referer', 'like', '%so.com%')->field('id')->count();
 | 
						|
 | 
						|
        // 百度今日
 | 
						|
        $data['todayBaidu'] = VisitLogoModel::where($today)->where('referer', 'like', '%baidu.com%')->field('id')->count();
 | 
						|
        // 360今日
 | 
						|
        $data['today360'] = VisitLogoModel::where($today)->where('referer', 'like', '%so.com%')->field('id')->count();
 | 
						|
 | 
						|
        // 今日留言
 | 
						|
        $data['todayMessage'] = \app\model\Message::where($today)->count();
 | 
						|
        // 总留言
 | 
						|
        $data['totalMessage']  = \app\model\Message::count();
 | 
						|
 | 
						|
        $this->data['data'] = $data;
 | 
						|
 | 
						|
        return $this->view();
 | 
						|
    }
 | 
						|
}
 |