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,