作者 刘锟

update

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 -}  
@@ -39,12 +39,12 @@ class Temp extends Command @@ -39,12 +39,12 @@ class Temp extends Command
39 39
40 public function check_m_visit() 40 public function check_m_visit()
41 { 41 {
42 - $list = SyncSubmitTask::where('project_id', 0)->where('data', 'like', '%m.m.%')->limit(5000)->get();  
43 - foreach ($list as $item){ 42 + $list = SyncSubmitTask::where('project_id', 0)->where('type', 'visit')->where('status', 2)->where('data', 'like', '%m.m.%')->limit(100)->get();
  43 + foreach ($list as $item) {
44 dump($item->id); 44 dump($item->id);
45 $data = $item->data; 45 $data = $item->data;
46 $item_data = $data['data']; 46 $item_data = $data['data'];
47 - $item_data = str_replace('m.m.', 'm.',$item_data); 47 + $item_data = str_replace('m.m.', 'm.', $item_data);
48 $data['data'] = $item_data; 48 $data['data'] = $item_data;
49 $data = str_replace('m.m.', 'm.', $data); 49 $data = str_replace('m.m.', 'm.', $data);
50 $item->data = $data; 50 $item->data = $data;