import request from './request';

export const saveCode = params => {
  return request({
    url: `mini/login`,
    data: params,
    method: 'get'
  });
};

export const getPhone = params => {
  return request({
    url: 'mini/phone',
    data: params,
    method: 'post'
  });
};

export const listStore = params => {
  return request({
    url: 'store/findAll',
    method: 'post',
    data: params
  }).then(res => res.data);
};

export const getLookUpData = params => {
  return request({
    url: `lookup/findByLookup/${params.type}`,
    method: 'get'
  }).then(res => res.data);
};

export const getIndexData = (params = {}) => {
  return request({
    url: `indexPage/findAll`,
    method: 'POST',
    data: params
  }).then(res => res.data);
};

export const getCouponPageData = (params = {}) => {
  return request({
    url: 'couponPage/findAll',
    method: 'POST',
    data: params
  }).then(res => res.data);
};

export const getRollAd = (params = {}) => {
  return request({
    url: 'buyNews/findAll',
    method: 'POST',
    data: params
  }).then(res => res.data);
};

export const get15CouponList = () => {
  return request({
    url: 'token/customerCoupon/findList',
    method: 'POST',
    data: {'couponId': 900015}
  }).then(res => res.data);
}

// 生成海报带二维码
export const getGenerateQR = params => {
  return request({
    url: `applet/generateQR/${params.inviterId}`,
    method: 'get'
  }).then(res => res.data);
}

// 拉新战报排行榜
export const battleReport = params => {
  return request({
    url: `token/statistics/battleReport`,
    method: 'post',
    data:{
      "inviterId": params.inviterId
    }
  }).then(res => res.data);
}
