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.

65 lines
1.8 KiB

<?php
namespace App\Models;
class ThirdAppointmentLog extends SoftDeletesModel
{
public function appointment()
{
return $this->hasOne(Appointment::class, 'id', 'appointment_id');
}
/**
* 添加记录
* @param $appointment_id
* @param $send_data
* @param $response_data
* @param string $remark
* @return mixed
*/
public static function add($appointment_id = 0, $course_sign_id = 0, $userId = 0, $url, $send_data, $response_data, $finally, $remark = '', $door_name = null, $end_time = null)
{
$where = [
'appointment_id' => $appointment_id,
'course_sign_id' => $course_sign_id,
'url' => $url,
'send_data' => is_array($send_data) ? json_encode($send_data, JSON_UNESCAPED_UNICODE) : $send_data,
];
$data = [
'appointment_id' => $appointment_id,
'course_sign_id' => $course_sign_id,
'url' => $url,
'send_data' => is_array($send_data) ? json_encode($send_data, JSON_UNESCAPED_UNICODE) : $send_data,
'response_data' => is_array($response_data) ? json_encode($response_data, JSON_UNESCAPED_UNICODE) : $response_data,
'finally' => $finally,
'remark' => $remark,
'user_id' => $userId,
'door_name' => $door_name,
'end_time' => $end_time
];
return self::updateOrCreate($where, $data);
}
/**
* 添加车牌记录
* @param $appointment_id
* @param $send_data
* @param $response_data
* @param string $remark
* @return mixed
*/
public static function addPlate($model, $plate, $status, $order_no = '')
{
$model->plate = $plate;
$model->plate_order_no = $order_no;
$model->plate_status = $status;
$model->save();
return $model;
}
}