From 1ba8bfcc4fc1ada9bcb61c88b897abdfeabbe8fc Mon Sep 17 00:00:00 2001 From: yumo Date: Fri, 8 Dec 2023 09:43:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BF=AE=E6=94=B9=E8=BD=AE?= =?UTF-8?q?=E6=92=AD=E5=B9=BF=E5=91=8A=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/AdminLog.php | 1 + app/admin/controller/Advert.php | 17 +++++++++++++++++ app/admin/controller/Image.php | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/app/admin/controller/AdminLog.php b/app/admin/controller/AdminLog.php index bbaf86b..f6ca92d 100644 --- a/app/admin/controller/AdminLog.php +++ b/app/admin/controller/AdminLog.php @@ -4,6 +4,7 @@ namespace app\admin\controller; use app\admin\extend\Util as Util; use app\admin\model\AdminLog as lModel; +use app\common\model\AdvertInfo; use app\Request; use Exception; use think\db\exception\DataNotFoundException; diff --git a/app/admin/controller/Advert.php b/app/admin/controller/Advert.php index eecb308..c802f78 100644 --- a/app/admin/controller/Advert.php +++ b/app/admin/controller/Advert.php @@ -254,6 +254,9 @@ class Advert extends AuthController * 保存修改 * @param string $id * @return mixed + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException */ public function saveAdvert($id = "") { @@ -283,4 +286,18 @@ class Advert extends AuthController cache(Data::DATA_ADVERT . '_' . $info['alias'], null);//清除缓存 return $res ? app("json")->success("操作成功", 'code') : app("json")->fail("操作失败"); } + + /** + * 删除广告 + * @param Request $request + * @return mixed + */ + public function delAdvert(Request $request) + { + $where = Util::postMore([ + ['id', ''], + ],$request); + if (empty($where['id'])) return app("json")->fail("参数错误,请刷新后重试"); + return (new \app\common\model\AdvertInfo)->where('id',$where['id'])->delete() ? app("json")->success("删除成功") : app("json")->fail("删除失败"); + } } \ No newline at end of file diff --git a/app/admin/controller/Image.php b/app/admin/controller/Image.php index 7b1a728..baca1ae 100644 --- a/app/admin/controller/Image.php +++ b/app/admin/controller/Image.php @@ -40,7 +40,7 @@ class Image extends AuthController * @throws DbException * @throws ModelNotFoundException */ - public function category(): array + public function category() { return app("json")->success(AttachmentCategory::buildNodes($this->type, 0, $this->request->param("title", ""))); }