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