From 84b5fcb6485ad919fc78b4967b2966d75f1c964f Mon Sep 17 00:00:00 2001 From: devil_gong Date: Wed, 27 Feb 2019 17:48:59 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=94=E5=9B=9E=E6=95=B0=E6=8D=AE=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/controller/Search.php | 8 ++++---- application/service/SearchService.php | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/application/api/controller/Search.php b/application/api/controller/Search.php index cbb6611c6..e202727bb 100755 --- a/application/api/controller/Search.php +++ b/application/api/controller/Search.php @@ -50,17 +50,17 @@ class Search extends Common SearchService::SearchAdd($this->data_post); // 获取数据 - $result = SearchService::GoodsList($this->data_post); + $ret = SearchService::GoodsList($this->data_post); // 分类 if(!empty($this->data_post['category_id'])) { - $result['category'] = GoodsService::GoodsCategoryRow(['id'=>$this->data_post['category_id']]); + $ret['data']['category'] = GoodsService::GoodsCategoryRow(['id'=>$this->data_post['category_id']]); } else { - $result['category'] = []; + $ret['data']['category'] = []; } - return DataReturn('success', 0, $result); + return $ret; } } ?> \ No newline at end of file diff --git a/application/service/SearchService.php b/application/service/SearchService.php index 8d15cbe1c..615c6ea35 100755 --- a/application/service/SearchService.php +++ b/application/service/SearchService.php @@ -130,10 +130,11 @@ class SearchService $page = intval(input('page', 1)); $n = 10; $m = intval(($page-1)*$n); - $result['data'] = GoodsService::CategoryGoodsList(['where'=>$where, 'm'=>$m, 'n'=>$n, 'order_by'=>$order_by]); + $goods = GoodsService::CategoryGoodsList(['where'=>$where, 'm'=>$m, 'n'=>$n, 'order_by'=>$order_by]); + $result['data'] = $goods['data']; $result['page_total'] = ceil($result['total']/$n); } - return $result; + return DataReturn('处理成功', 0, $result); } /**