From da228bda16baeb26fbca4cbf66de136842499d92 Mon Sep 17 00:00:00 2001 From: liuxiaoquan Date: Tue, 28 Feb 2023 17:12:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=96=E6=B6=88api=E8=8E=B7=E8=81=8C?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/Cultural.php | 2 +- app/api/controller/Education.php | 2 +- app/api/controller/HouseDecoration.php | 8 ++++---- app/api/controller/PublicBenefit.php | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/api/controller/Cultural.php b/app/api/controller/Cultural.php index e967c6d..c06daef 100644 --- a/app/api/controller/Cultural.php +++ b/app/api/controller/Cultural.php @@ -22,7 +22,7 @@ class Cultural extends BaseController protected function getData($cid){ $where = ['category_id'=>$cid]; - $list = Db::table('fa_article')->field('id')->where($where) + $list = Db::table('fa_article')->where($where) ->page(1) ->limit(10) ->order('id desc') diff --git a/app/api/controller/Education.php b/app/api/controller/Education.php index a00a73b..f26aa91 100644 --- a/app/api/controller/Education.php +++ b/app/api/controller/Education.php @@ -25,7 +25,7 @@ class Education extends BaseController protected function getData($cid){ $where = ['category_id'=>$cid]; - $list = Db::table('fa_article')->field('id')->withAttr('lesson', + $list = Db::table('fa_article')->withAttr('lesson', function($value, $data){ return Db::table(self::ARTICLE_EDUCATION_LIVE)->field('lesson_period,tag_ids as series_num')->where('article_id', $data['id'])->find(); } diff --git a/app/api/controller/HouseDecoration.php b/app/api/controller/HouseDecoration.php index 691be9c..63ae3e4 100644 --- a/app/api/controller/HouseDecoration.php +++ b/app/api/controller/HouseDecoration.php @@ -17,12 +17,12 @@ class HouseDecoration extends BaseController * @var array */ protected $middleware = [ - Auth::class => ['except' => ['Case','Store'] ] + Auth::class => ['except' => ['case','store'] ] ]; protected function getData($cid){ $where = ['category_id'=>$cid]; - $list = Db::table('fa_article')->field('id') + $list = Db::table('fa_article') // ->withAttr('enroll', // function($value, $data){ // return Db::table(self::ARTICLE_PUBLIC_BENEFIT)->field('promoter,enrolled_num')->where('article_id', $data['id'])->find(); @@ -37,12 +37,12 @@ class HouseDecoration extends BaseController return $list; } - public function Case(){ + public function case(){ $data = $this->getData(499); $this->apiSuccess('ok', ['list' => $data]); } - public function Store(){ + public function store(){ $data = $this->getData(501); $this->apiSuccess('ok', ['list' => $data]); } diff --git a/app/api/controller/PublicBenefit.php b/app/api/controller/PublicBenefit.php index 4858255..db6ab9b 100644 --- a/app/api/controller/PublicBenefit.php +++ b/app/api/controller/PublicBenefit.php @@ -24,7 +24,7 @@ class PublicBenefit extends BaseController protected function getData($cid){ $where = ['category_id'=>$cid]; - $list = Db::table('fa_article')->field('id')->withAttr('enroll', + $list = Db::table('fa_article')->withAttr('enroll', function($value, $data){ return Db::table(self::ARTICLE_PUBLIC_BENEFIT)->field('promoter,enrolled_num')->where('article_id', $data['id'])->find(); }