Yesterday.php
1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
namespace App\Console\Commands\YesterdayCount;
use App\Models\CustomerVisit\CustomerVisitItem;
use App\Models\Project\DeployBuild;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
class Yesterday extends Command
{
public $error = 0;
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'yesterday_count';
/**
* The console command description.
*
* @var string
*/
protected $description = '统计昨日数据';
/**
* @name :(定时执行)handle
* @author :lyh
* @method :post
* @time :2023/5/12 14:48
*/
public function handle()
{
$deployModel = new DeployBuild();
$list = $deployModel->list();
$data = [];
foreach ($list as $v){
$arr = [];
$yesterday = now()->subDay();
$arr['yesterday_pv_num'] = DB::table('gl_customer_visit_item')->whereDate('created_at', $yesterday)->where('domain',$v['test_domain'])->count();
$arr['yesterday_ip_num'] = DB::table('gl_customer_visit')->whereDate('created_at', $yesterday)->where('domain',$v['test_domain'])->count();
$arr['inquiry_num'] = DB::table('gl_inquiry_set')->whereDate('created_at', $yesterday)->where('project_id',$v['project_id'])->count();
$arr['rank_compliance_num'] = DB::table('rank_compliance_num')->whereDate('created_at', $yesterday)->where('project_id',$v['project_id'])->count();
}
}
}