From 2cf50f16fb684ec7828f623cd46b2b0f1ff43420 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Fri, 29 Nov 2024 15:25:13 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E9=9A=8F=E6=89=8B=E6=8B=8D?= =?UTF-8?q?=E5=90=8E=E5=8F=B0=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugs/think-plugs-ticket/src/controller/UserShare.php | 4 ++-- plugs/think-plugs-ticket/src/model/TicketUserShare.php | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/plugs/think-plugs-ticket/src/controller/UserShare.php b/plugs/think-plugs-ticket/src/controller/UserShare.php index cac7e37..1b60e39 100644 --- a/plugs/think-plugs-ticket/src/controller/UserShare.php +++ b/plugs/think-plugs-ticket/src/controller/UserShare.php @@ -24,14 +24,14 @@ class UserShare extends Controller public function index() { $this->title = '用户随手拍'; - $this->type_list = TicketType::getTypeList(); + $this->type_list = TicketType::getList(); TicketUserShare::mQuery()->layTable(function () { }, function (QueryHelper $query) { $query->like(['title|content|ticket_address|contact_phone#keyword']) ->dateBetween(['create_at']) ->equal(['status', 'type_id']); - $query->with(['user'])->append(['imgs_arr', 'status_text', 'type_name', 'last_reply']); + $query->with(['user'])->append(['imgs_arr', 'type_name']); }); } diff --git a/plugs/think-plugs-ticket/src/model/TicketUserShare.php b/plugs/think-plugs-ticket/src/model/TicketUserShare.php index b1c6b1b..0c823d7 100644 --- a/plugs/think-plugs-ticket/src/model/TicketUserShare.php +++ b/plugs/think-plugs-ticket/src/model/TicketUserShare.php @@ -10,4 +10,14 @@ class TicketUserShare extends Model { return str2arr($data['imgs'] ?: '', '|'); } + + public function getTypeNameAttr($value, $data) + { + $type = $this->type()->find(); + if (!empty($type)) { + return $type['name']; + } else { + return '未知'; + } + } } \ No newline at end of file