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);