import request from './request';
let api = {
  getCouponInclude: '/coupon/market/Discount/getCouponInclude', // 获取优惠券
  receiveCoupon: '/coupon/market/DiscountDetail/receive' // 领取优惠券
};
const prodApi = {
  getCouponInclude: 'https://coupon.guangdianyun.tv/v1/coupon/market/Discount/getCouponInclude', // 获取优惠券
  receiveCoupon: 'https://coupon.guangdianyun.tv/v1/coupon/market/DiscountDetail/receive' // 领取优惠券
};
const preApi = {
  // getCouponInclude: "", // 获取优惠券
  // receiveCoupon: "" // 领取优惠券
};
const testApi = {
  // getCouponInclude: "", // 获取优惠券
  // receiveCoupon: "" // 领取优惠券
};
if (!process.env.private) {
  if (!process.env.X_CA_STAGE) {
    api = { ...api, ...prodApi };
  } else if (process.env.X_CA_STAGE === 'PRE') {
    api = { ...api, ...preApi };
  } else if (process.env.X_CA_STAGE === 'TEST') {
    api = { ...api, ...testApi };
  }
}
export const getCouponInclude = data => {
  return request.get(api['getCouponInclude'], data);
};
export const receiveCoupon = data => {
  return request.post(api['receiveCoupon'], data);
};
export default {
  getCouponInclude,
  receiveCoupon
};
