From 6c6194555d6385bb771847199a175e4d265ed497 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E4=BC=9F?= <943146732@qq.com> Date: Tue, 12 Mar 2024 23:02:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=8E=A5=E5=8F=A3=E7=9B=B8?= =?UTF-8?q?=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/store/controller/content/Maintenance.php | 23 +++++++++++++++----- app/store/model/Maintenance.php | 8 +++++-- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/app/store/controller/content/Maintenance.php b/app/store/controller/content/Maintenance.php index 63c0f49e..a319fbfa 100644 --- a/app/store/controller/content/Maintenance.php +++ b/app/store/controller/content/Maintenance.php @@ -35,6 +35,17 @@ class Maintenance extends Controller return $this->renderSuccess(compact('list')); } + /** + * 文章详情 + * @param int $maintenanceId + * @return Json + */ + public function detail(int $maintenanceId): Json + { + $detail = MaintenanceModel::detail($maintenanceId); + return $this->renderSuccess(compact('detail')); + } + /** @@ -51,13 +62,13 @@ class Maintenance extends Controller } /** - * @param int $articleId + * @param int $maintenanceId * @return Json */ - public function edit(int $articleId): Json + public function edit(int $maintenanceId): Json { // 文章详情 - $model = MaintenanceModel::detail($articleId); + $model = MaintenanceModel::detail($maintenanceId); // 更新记录 if ($model->edit($this->postForm())) { return $this->renderSuccess('更新成功'); @@ -67,13 +78,13 @@ class Maintenance extends Controller /** * 删除文章 - * @param int $articleId + * @param int $maintenanceId * @return Json */ - public function delete(int $articleId): Json + public function delete(int $maintenanceId): Json { // 文章详情 - $model = MaintenanceModel::detail($articleId); + $model = MaintenanceModel::detail($maintenanceId); if (!$model->setDelete()) { return $this->renderError($model->getError() ?: '删除失败'); } diff --git a/app/store/model/Maintenance.php b/app/store/model/Maintenance.php index 25655add..7f09e2fe 100644 --- a/app/store/model/Maintenance.php +++ b/app/store/model/Maintenance.php @@ -37,7 +37,7 @@ class Maintenance extends MaintenanceModel ]); // 检索查询条件 $filter = []; - !empty($params['name']) && $filter[] = ['name', 'like', "%{$params['title']}%"]; + !empty($params['name']) && $filter[] = ['name', 'like', "%{$params['name']}%"]; $params['status'] > -1 && $filter[] = ['status', '=', $params['status']]; $params['categoryId'] > 0 && $filter[] = ['category_id', '=', $params['categoryId']]; // 查询列表数据 @@ -62,12 +62,16 @@ class Maintenance extends MaintenanceModel return false; } - if (($data['parent_id']) != 0) { + /* if (($data['parent_id']) != 0) { if (empty($data['url'])) { $this->error = '请输地址'; return false; } + } */ + if (empty($data['url'])) { + $this->error = '请输地址'; + return false; } $data['store_id'] = self::$storeId; return $this->save($data);