diff --git a/app/admin/controller/v1/Attachment.php b/app/admin/controller/v1/Attachment.php index 611c2621..2775c476 100644 --- a/app/admin/controller/v1/Attachment.php +++ b/app/admin/controller/v1/Attachment.php @@ -61,14 +61,29 @@ class Attachment { $id = request()->param('id'); - $attachment = AttachmentModel::withoutField([ - 'language_id', - 'created_at', - 'updated_at', - 'deleted_at' + $attachment = AttachmentModel::with(['category' => function ($query) { + $query->field(['id', 'name' => 'category_name']); + }]) + ->field([ + 'id', + 'category_id', + 'name', + 'desc', + 'image', + 'applicable_to', + 'support_platform', + 'attach', + 'sort', + 'recommend', + 'status', + 'seo_title', + 'seo_keywords', + 'seo_desc' ]) ->bypk($id) - ->find(); + ->find() + ->bindAttr('category', ['category_name']) + ->hidden(['category']); if (empty($attachment)) { return error('附件不存在'); }