|
1
|
-<?php
|
|
|
|
2
|
-
|
|
|
|
3
|
-namespace App\Console\Commands\Test;
|
|
|
|
4
|
-
|
|
|
|
5
|
-use App\Models\SyncSubmitTask\SyncSubmitTask;
|
|
|
|
6
|
-use App\Models\Visit\Visit;
|
|
|
|
7
|
-use App\Services\ProjectServer;
|
|
|
|
8
|
-use Illuminate\Console\Command;
|
|
|
|
9
|
-
|
|
|
|
10
|
-class InquiryVisit extends Command
|
|
|
|
11
|
-{
|
|
|
|
12
|
- /**
|
|
|
|
13
|
- * The name and signature of the console command.
|
|
|
|
14
|
- *
|
|
|
|
15
|
- * @var string
|
|
|
|
16
|
- */
|
|
|
|
17
|
- protected $signature = 'temp_inquiry_visit';
|
|
|
|
18
|
-
|
|
|
|
19
|
- /**
|
|
|
|
20
|
- * The console command description.
|
|
|
|
21
|
- *
|
|
|
|
22
|
- * @var string
|
|
|
|
23
|
- */
|
|
|
|
24
|
- protected $description = '临时脚本(akun)';
|
|
|
|
25
|
-
|
|
|
|
26
|
- public function handle()
|
|
|
|
27
|
- {
|
|
|
|
28
|
- $list = SyncSubmitTask::select(['id', 'project_id', 'data', 'created_at'])->where('project_id', '>', 0)->where('type', 'inquiry')->where('status', 1)->get();
|
|
|
|
29
|
-
|
|
|
|
30
|
- foreach ($list as $item) {
|
|
|
|
31
|
- $project_id = $item->project_id;
|
|
|
|
32
|
- $data = $item->data;
|
|
|
|
33
|
- $day_time = substr($item->created_at, 0, 10);
|
|
|
|
34
|
- ProjectServer::useProject($project_id);
|
|
|
|
35
|
-
|
|
|
|
36
|
- $visit = Visit::where("ip", $data['ip'])->where("created_at", ">=", $day_time . ' 00:00:00')
|
|
|
|
37
|
- ->where("created_at", "<=", $day_time . ' 23:59:59')
|
|
|
|
38
|
- ->first();
|
|
|
|
39
|
- if ($visit) {
|
|
|
|
40
|
- $visit->is_inquiry = 1;
|
|
|
|
41
|
- $visit->save();
|
|
|
|
42
|
- dump($item->id);
|
|
|
|
43
|
- }
|
|
|
|
44
|
- }
|
|
|
|
45
|
- }
|
|
|
|
46
|
-} |
|
|