修复修改轮播广告的bug

This commit is contained in:
yumo 2023-12-08 09:43:10 +08:00
parent 1d35393458
commit 1ba8bfcc4f
3 changed files with 19 additions and 1 deletions

View File

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

View File

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

View File

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