import request from '@/utils/request'

/**
 * 全站搜索（商品 + 店铺一次返回）
 * @param {Object} params keyword, sortBy, goodsPageNum, goodsPageSize, shopPageNum, shopPageSize
 * @returns {Promise<{ goods: { total, rows }, shops: { total, rows } }>}
 */
export function searchAll(params) {
  return request({
    url: '/api/search',
    method: 'GET',
    params,
    header: { isToken: false },
    silent: true
  }).then((res) => res.data || { goods: { total: 0, rows: [] }, shops: { total: 0, rows: [] } })
}
