|
|
|
@ -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() ?: '删除失败'); |
|
|
|
|
} |
|
|
|
|