From 1e8e98f99800c77ad8a85bd3cb3766a90bb01c31 Mon Sep 17 00:00:00 2001 From: wangxinglong <2371974647@qq.com> Date: Fri, 21 Jan 2022 14:38:01 +0800 Subject: [PATCH] setter --- app/controller/api/Consumer.php | 19 +++++++++++++++++++ app/model/Slide.php | 1 + 2 files changed, 20 insertions(+) diff --git a/app/controller/api/Consumer.php b/app/controller/api/Consumer.php index 0f32fff..f9f5645 100644 --- a/app/controller/api/Consumer.php +++ b/app/controller/api/Consumer.php @@ -174,6 +174,25 @@ class Consumer extends Base return $this->json(1,"ok",$list["list"]); } + /** + * 广告列表 + * */ + public function advertisement() + { + $repo = OperationRepository::getInstance(); + $whereMap = []; + $orders = ['sort'=>'asc']; + $page = input("page/d",1); + $size = input("size/d",1000); + $whereMap[] = ['position', '=', Slide::advertisement]; + $list = $repo->slideList($whereMap, ["id","title","src as image","url","url_type as type"], $page, $size, function ($q){ + return $q->withAttr("image",function ($value){ + return $this->request->domain() . $value; + }); + }, $orders); + return $this->json(1,"ok",$list["list"]); + } + /** * 关注/取消关注一个商家 diff --git a/app/model/Slide.php b/app/model/Slide.php index e90a1c5..93f3cb9 100644 --- a/app/model/Slide.php +++ b/app/model/Slide.php @@ -5,6 +5,7 @@ namespace app\model; class Slide extends Base { public const homePosition = "home-banner"; + public const advertisement = "advertisement"; public static function delByIds($ids) { return self::whereIn('id', $ids)->delete();