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", ""))); }