InquiryVisit.php
1.3 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\Test;
use App\Models\SyncSubmitTask\SyncSubmitTask;
use App\Models\Visit\Visit;
use App\Services\ProjectServer;
use Illuminate\Console\Command;
class InquiryVisit extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'temp_inquiry_visit';
/**
* The console command description.
*
* @var string
*/
protected $description = '临时脚本(akun)';
public function handle()
{
$list = SyncSubmitTask::select(['id', 'project_id', 'data', 'created_at'])->where('project_id', '>', 0)->where('type', 'inquiry')->where('status', 1)->get();
foreach ($list as $item) {
$project_id = $item->project_id;
$data = $item->data;
$day_time = substr($item->created_at, 0, 10);
ProjectServer::useProject($project_id);
$visit = Visit::where("ip", $data['ip'])->where("created_at", ">=", $day_time . ' 00:00:00')
->where("created_at", "<=", $day_time . ' 23:59:59')
->first();
if ($visit) {
$visit->is_inquiry = 1;
$visit->save();
dump($item->id);
}
}
}
}