mirror of
https://gitee.com/zongzhige/shopxo.git
synced 2024-11-29 18:39:16 +08:00
搜索记录优化、仅保留商品id
This commit is contained in:
parent
e6afc9bac2
commit
41aa64b55a
@ -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']));
|
||||
}
|
||||
}
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user