From 754a4e67828da0e23643c84615eb8760f18bb518 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Wed, 19 Mar 2025 09:33:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E4=B8=BA=E5=B7=A1=E6=A3=80?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E4=B8=8A=E6=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/controller/api/auth/Ticket.php | 2 -- .../src/model/InspectionRecord.php | 3 +- .../src/model/TicketInspectionShare.php | 35 +++++++++++++++++++ 3 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 plugs/think-plugs-ticket/src/model/TicketInspectionShare.php diff --git a/plugs/think-plugs-inspection/src/controller/api/auth/Ticket.php b/plugs/think-plugs-inspection/src/controller/api/auth/Ticket.php index 0e5a0d7..38359d9 100644 --- a/plugs/think-plugs-inspection/src/controller/api/auth/Ticket.php +++ b/plugs/think-plugs-inspection/src/controller/api/auth/Ticket.php @@ -27,9 +27,7 @@ class Ticket extends Auth $ticket_region = $this->request->post('ticket_region'); $ticket_address = $this->request->post('ticket_address'); $imgs = $this->request->post('imgs'); - $ticket_project_use = $this->request->post('ticket_project_use'); $ticket_work_use = $this->request->post('ticket_work_use'); - $ticket_price =$this->request->post('ticket_price'); $data = [ 'uid' => $this->staff->id, 'utype' => $this->staff->id, diff --git a/plugs/think-plugs-inspection/src/model/InspectionRecord.php b/plugs/think-plugs-inspection/src/model/InspectionRecord.php index c8fbe5e..3dc797b 100644 --- a/plugs/think-plugs-inspection/src/model/InspectionRecord.php +++ b/plugs/think-plugs-inspection/src/model/InspectionRecord.php @@ -3,6 +3,7 @@ namespace plugin\inspection\model; use Cassandra\Date; +use plugin\ticket\model\TicketInspectionShare; use plugin\ticket\model\TicketTicket; use think\admin\Model; @@ -73,7 +74,7 @@ class InspectionRecord extends Model public function ticket() { - return $this->morphMany(TicketTicket::class, 'source'); + return $this->hasMany(TicketInspectionShare::class, 'record_id', 'id'); } } \ No newline at end of file diff --git a/plugs/think-plugs-ticket/src/model/TicketInspectionShare.php b/plugs/think-plugs-ticket/src/model/TicketInspectionShare.php new file mode 100644 index 0000000..07f2ee0 --- /dev/null +++ b/plugs/think-plugs-ticket/src/model/TicketInspectionShare.php @@ -0,0 +1,35 @@ +belongsTo(TicketType::class, 'type_id', 'id'); + } + + public function getTypeNameAttr($value, $data) + { + $type = $this->type()->find(); + if (!empty($type)) { + return $type['name']; + } else { + return '未知'; + } + } + + public function linkedTicket() + { + return $this->belongsTo(TicketTicket::class, 'linked_ticket_id', 'id'); + } + +} \ No newline at end of file