|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Console\Commands\Test;
|
|
|
|
|
|
|
|
use App\Models\SyncSubmitTask\SyncSubmitTemp;
|
|
|
|
use App\Models\Visit\Visit;
|
|
|
|
use App\Services\ProjectServer;
|
|
|
|
use Carbon\Carbon;
|
|
|
|
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 = SyncSubmitTemp::select(['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) {
|
|
|
|
dd($visit);
|
|
|
|
$visit->is_inquiry = 1;
|
|
|
|
$visit->save();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|