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); } /**