import { qs } from '@/utils'
import { http } from '@/utils/http'

const pre = import.meta.env.VITE_SERVER_BASEURL_PREFIX
const pre1 = import.meta.env.VITE_API_SECONDARY_URL_PREFIX
/**
 * 新增收获地址
 * @returns
 */
export function addressAdd(data: any) {
  return http.post<any>(`${pre}/app/user/address/add`, data)
}

/**
 * 收获地址列表
 * @returns
 */
export function addressList(data: any) {
  return http.post<any>(`${pre}/app/user/address/list`, data)
}

/**
 * 收获地址详情 入参id
 * @returns
 */
export function addressDetail(data: any) {
  return http.get<any>(`${pre}/app/user/address/detail`, data)
}

/**
 * 收获地址更新
 * @returns
 */
export function addressUpdate(data: any) {
  return http.put<any>(`${pre}/app/user/address/update`, data)
}
/**
 * 收获地址删除 入参id
 * @returns
 */
export function addressDel(data: any) {
  return http.delete<any>(`${pre}/app/user/address/delete?${qs(data)}`)
}

/**
 * 七日签到列表
 * @returns
 */
export function todayDetail() {
  return http.get<any>(`${pre}/app/user/sign/todayDetail`)
}
/**
 * 签到
 * @returns
 */
export function clockIn() {
  return http.post<any>(`${pre}/app/user/sign/clockIn`)
}

/**
 * 会员等级配置
 * @returns
 */
export function memberConfigs() {
  return http.get<any>(`${pre1}/api/user/memberConfigs`)
}

/**
 * 获取邀请的用户
 * @returns
 */
export function myUsers(data: any) {
  return http.post<any>(`${pre1}/api/user/myUsers`, data)
}

/**
 * 我的收藏-商品列表
 * @returns
 */
export function myFavoriteProducts(data: any) {
  return http.post<any>(`${pre}/app/mid/favorite/list`, data)
}

/**
 * 我的收藏-新增 {productIdList:[1]}
 * @returns
 */
export function myFavoriteAdd(data: any) {
  return http.post<any>(`${pre}/app/mid/favorite/add`, data)
}

/**
 * 我的收藏-删除  {id:1}
 * @returns
 */
export function myFavoriteDel(data: any) {
  return http.delete<any>(`${pre}/app/mid/favorite/delete`, data)
}
