作者 lyh

gx

<?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();
}
}
}
... ...
... ... @@ -24,12 +24,9 @@ class AyrReleaseRequest extends FormRequest
{
return [
'title'=>'required',
// 'images'=>'required|array',
// 'video'=>'required',
'content'=>'required',
'share_id'=>'required',
'platforms'=>'required|array',
// 'schedule_date'=>'required',
];
}
... ...
<?php
namespace App\Models\CustomerVisit;
use App\Models\Base;
class CustomerVisit extends Base
{
protected $table = 'gl_customer_visit';
}
... ...
<?php
namespace App\Models\CustomerVisit;
use App\Models\Base;
class CustomerVisitItem extends Base
{
protected $table = 'gl_customer_visit_item';
}
... ...