diff --git a/app/common/dao/system/AppUpdateDao.php b/app/common/dao/system/AppUpdateDao.php index 15f04f4c..be39bb94 100644 --- a/app/common/dao/system/AppUpdateDao.php +++ b/app/common/dao/system/AppUpdateDao.php @@ -48,5 +48,9 @@ class AppUpdateDao extends BaseDao $query->where('type',$where['type']); }); } + public function delete(int $id) + { + return ($this->getModel()::getDB())->where('id', $id)->delete(); + } } diff --git a/app/common/repositories/system/LhappRepository.php b/app/common/repositories/system/LhappRepository.php index 817bce7a..2568824b 100644 --- a/app/common/repositories/system/LhappRepository.php +++ b/app/common/repositories/system/LhappRepository.php @@ -55,4 +55,10 @@ class LhappRepository extends BaseRepository return $find; } + public function delete($id) + { + $res = $this->dao->delete($id); + return $res; + } + } diff --git a/app/controller/admin/system/Lhapp.php b/app/controller/admin/system/Lhapp.php index 688ee05b..344ce0bd 100644 --- a/app/controller/admin/system/Lhapp.php +++ b/app/controller/admin/system/Lhapp.php @@ -53,12 +53,23 @@ class Lhapp extends BaseController $this->repository->update($id, $this->getValidParams()); return app('json')->success('修改成功'); } + public function detail($id) { $data = $this->repository->detail($id); return app('json')->success($data); } + public function delete($id) + { + $res = $this->repository->delete($id); + if ($res) { + return app('json')->success('删除成功'); + } else { + return app('json')->fail('删除失败'); + } + } + protected function getValidParams() { $data = $this->request->params(['title', 'content', 'type', 'phone_brand', 'version', 'dow_url', 'force', 'quiet']); diff --git a/route/admin/system.php b/route/admin/system.php index 588536aa..0253b5a4 100644 --- a/route/admin/system.php +++ b/route/admin/system.php @@ -183,6 +183,9 @@ Route::group(function () { Route::post('edit/:id', '/update')->name('appVersionEdit')->option([ '_alias' => '编辑APP版本', ]); + Route::post('delete/:id', '/delete')->name('appVersionEdit')->option([ + '_alias' => '删除APP版本', + ]); })->prefix('admin.system.Lhapp')->option([ '_path' => '/app/version', '_auth' => true,