You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.4 KiB
64 lines
1.4 KiB
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Models\Appointment;
|
|
use App\Models\ThirdAppointmentLog;
|
|
use Illuminate\Console\Command;
|
|
|
|
|
|
class UpdateAppointment extends Command
|
|
{
|
|
protected $tryTimes = 3;
|
|
protected $scheduleNumber = 10;
|
|
/**
|
|
* The name and signature of the console command.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $signature = 'update_appointment';
|
|
|
|
/**
|
|
* The console command description.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $description = '更新预约状态';
|
|
|
|
/**
|
|
* Create a new command instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
|
|
/**
|
|
* Execute the console command.
|
|
*
|
|
* @return mixed
|
|
*/
|
|
public function handle()
|
|
{
|
|
$appointments = Appointment::where('status', 1)
|
|
->where('created_at', 'like', '%' . date('Y-m-d') . '%')
|
|
->get();
|
|
foreach ($appointments as $appointment) {
|
|
$thirdAppointmentLogs = ThirdAppointmentLog::where('appointment_id', $appointment->id)
|
|
// 排除掉获取二维码的请求
|
|
->where('url', 'not like', '%GetEmpQrCode%')
|
|
->where('finally', 0)
|
|
->first();
|
|
if ($thirdAppointmentLogs) {
|
|
$appointment->status = 4;
|
|
$appointment->save();
|
|
}
|
|
}
|
|
return self::SUCCESS;
|
|
}
|
|
|
|
|
|
}
|