/* 活动中心API接口请求函数 */
import api from '@/api/http.js'
const BASE_URL = process.env.VUE_APP_DoctorAPIUrl
const CurrentMode = process.env.VUE_APP_Name
// 获取引流信息
export const reqGetFlowInfo = (id) => {
  return api.get(BASE_URL + `/ymall/guideflow/get/?id=${id}`)
}

// 完成引流跳转时接口
export const reqFlowFinished = (data) => {
  return api.put(BASE_URL + '/ymall/guideflow/finish', data)
}

// 获取微信签名信息
export const reqGetWeixinSign = (url = process.env.VUE_APP_DoctorAPIUrl) => {
  if (CurrentMode === '测试环境' || CurrentMode === '开发环境')
    return api.get(
      BASE_URL + '/ymallWechat/getSignature?url=' + 'https://mem.360lj.com/ui/'
    )
  if (CurrentMode === '生产环境')
    return api.get(
      BASE_URL + '/ymallWechat/getSignature?url=' + 'https://mem.360lj.com/ue/'
    )
}

// 活动基础信息查询接口，包含奖品信息返回、跳转信息返回、领奖的二维码返回
/**
 *
 * @param {string, number} id url中的参数id
 */
export const reqGetFriendsHelpBaseInfo = (id) => {
  return api.get(BASE_URL + `/ymall/activity/get?id=${id}`)
}

// 获取授权用户的邀请好友记录，是否已经领取奖品标记
export const reqInviteFriendsInfo = (payload) => {
  return api.get(BASE_URL + '/ymall/jointor/get', { params: payload })
}

// 获取邀请用户（被助力的用户）的信息列表
export const reqGetJointorInfo = (acjoinId) => {
  return api.get(BASE_URL + `/ymall/jointor/getJointorInfo?id=${acjoinId}`)
}

// 领取奖品判断是否绑定手机号接口
export const reqJudgeMobileIsNull = (payload) => {
  return api.get(BASE_URL + `/ymall/user/mobileIsNotEmpty`, {params: payload})
}

// 助力页面获取活动基础信息查询接口
export const reqActivityInfo = (acjoinId)=>{
  return api.get(`${BASE_URL}/ymall/activity/getInfo?acjoinId=${acjoinId}`)
}

// 点击助力接口
export const reqHelper = (data) => {
  return api.put(`${BASE_URL}/ymall/helper/helped`, data)
}

// 邀请好友弹窗图片生成接口
export const reqCreateImage = (data)=>{
  return api.post(`${BASE_URL}/ymall/jointor/create`, data)
}