From 41aa64b55a472339a0047931a4604f9556edf02e Mon Sep 17 00:00:00 2001 From: gongfuxiang Date: Wed, 13 Jul 2022 11:28:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E8=AE=B0=E5=BD=95=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E3=80=81=E4=BB=85=E4=BF=9D=E7=95=99=E5=95=86=E5=93=81?= =?UTF-8?q?id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/Search.php | 11 +++++++---- app/service/SearchService.php | 6 ++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/api/controller/Search.php b/app/api/controller/Search.php index ae12fc9df..7829cf520 100755 --- a/app/api/controller/Search.php +++ b/app/api/controller/Search.php @@ -77,15 +77,18 @@ class Search extends Common */ public function DataList() { - // 搜索记录 - $this->data_post['user_id'] = isset($this->user['id']) ? $this->user['id'] : 0; - SearchService::SearchAdd($this->data_post); - // 搜素条件 $map = SearchService::SearchWhereHandle($this->data_post); // 获取数据 $ret = SearchService::GoodsList($map, $this->data_post); + + // 搜索记录 + $this->data_post['user_id'] = isset($this->user['id']) ? $this->user['id'] : 0; + $this->data_post['search_result_data'] = $ret['data']; + SearchService::SearchAdd($this->data_post); + + // 返回数据 return ApiService::ApiDataReturn(SystemBaseService::DataReturn($ret['data'])); } } diff --git a/app/service/SearchService.php b/app/service/SearchService.php index 42ca52ee5..774474b81 100755 --- a/app/service/SearchService.php +++ b/app/service/SearchService.php @@ -512,6 +512,12 @@ class SearchService $ov_arr = [$params['order_by_field'], $params['order_by_type']]; } + // 结果仅保留商品id + if(!empty($params['search_result_data']) && is_array($params['search_result_data']) && !empty($params['search_result_data']['data'])) + { + $params['search_result_data']['data'] = array_column($params['search_result_data']['data'], 'id'); + } + // 日志数据 $data = [ 'user_id' => isset($params['user_id']) ? intval($params['user_id']) : 0,