// 引入 request 文件
import request from '../common/request.js'

//判断是否收藏
export const collectif = (data,header) => {
    return request({
        url: '/collect/user/'+data,
        method: 'get',
		header:header,
    })
}
// 添加/取消收藏
export const collecttian = (data,header) => {
    return request({
        url: '/collect/user/'+data,
        method: 'post',
		header:header,
    })
}
//添加商品足迹
export const footgoods = (data,header) => {
    return request({
        url: '/footprint/user/'+data+'/add',
        method: 'post',
		header:header,
    })
}
//商品详情
export const goodsxiang = (data) => {
    return request({
        url: '/goods/open/'+data,
        method: 'get',
    })
}
//加入购物车
export const cartadd = (data) => {
    return request({
        url: '/user/cart/'+data,
        method: 'put',
		header:{
			"Mall-Token": uni.getStorageSync('tokenId')
		},
    })
}
// 商品评价
export const pingjia = (data) => {
    return request({
        url: '/goodsComment/open/list',
        method: 'get',
		header:{
			"Mall-Token": uni.getStorageSync('tokenId')
		},
    })
}
//新增历史搜索
export const searchadd = (data,header) => {
    return request({
        url: '/usersearchhistory/save',
        method: 'post',
		header:header,
		data:data
    })
}
//搜索历史列表
export const searchlist = (header) => {
    return request({
        url: '/usersearchhistory/list',
        method: 'get',
		header:{
			"Mall-Token": uni.getStorageSync('tokenId')
		},
    })
}
//热门搜索列表
export const searchhot = (header) => {
    return request({
        url: '/searchHot/open/list',
        method: 'get',
		header:{
			"Mall-Token": uni.getStorageSync('tokenId')
		},
    })
}
// 清空搜索历史
export const searchclear = (data) => {
    return request({
        url: '/usersearchhistory/delete',
        method: 'delete',
		header:{
			'Content-Type': "application/json",
			"Mall-Token": uni.getStorageSync('tokenId')
		},
		data:data
    })
}