From 0b6564808d271d2bf6479b508dfd4036532e5ea3 Mon Sep 17 00:00:00 2001 From: sugar1569 Date: Thu, 18 Apr 2019 11:58:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=85=AC=E4=BC=97=E5=8F=B7?= =?UTF-8?q?=E9=A6=96=E9=A1=B5=E8=8E=B7=E5=8F=96=E4=BA=A7=E5=93=81=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/wap/controller/PublicApi.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/application/wap/controller/PublicApi.php b/application/wap/controller/PublicApi.php index c37a21e2..e780cf80 100644 --- a/application/wap/controller/PublicApi.php +++ b/application/wap/controller/PublicApi.php @@ -68,6 +68,30 @@ class PublicApi return JsonService::successful($result); } + /** 首页获取推荐产品 + * @param int $first + * @param int $limit + */ + public function get_product_list($first = 0,$limit = 8) + { + $StoreProductmodel = StoreProduct::validWhere(); + if(input('type')=='is_best') + $StoreProductmodel = $StoreProductmodel->where('is_best',1); + if(input('type')=='is_hot') + $StoreProductmodel = $StoreProductmodel->where('is_hot',1); + if(input('type')=='is_benefit') + $StoreProductmodel = $StoreProductmodel->where('is_benefit',1); + if(input('type')=='is_new') + $StoreProductmodel = $StoreProductmodel->where('is_new',1); + if(input('type')=='is_postage') + $StoreProductmodel = $StoreProductmodel->where('is_postage',1); + + $list = $StoreProductmodel->where('mer_id',0)->order('is_best DESC,sort DESC,add_time DESC') + ->limit($first,$limit)->field('id,image,store_name,sales,price,unit_name')->select()->toArray(); + + return JsonService::successful($list); + } + public function get_best_product_list($first = 0,$limit = 8) { $list = StoreProduct::validWhere()->where('mer_id',0)->order('is_best DESC,sort DESC,add_time DESC')