import request from './request';
let api = {
  getDrainage: '/Program/Live/getDrainage', // 获取app引流配置 
  getDrainageStatus: '/Program/Live/getDrainageStatus', // 获取app引流配置 
  getWelcomePage: '/welcome/Index/getWelcomePage', // 获取欢迎页配置
  getChannelConfig: '/Program/Index/getChannelConfig', // 获取直播间配置
  getChatCount: '/Program/Live/getChatCount', // 获取聊天数
  getWatchLoginInfo: '/Program/Index/getWatchLoginInfo', // 获取登录信息
  getWechatInfo: '/Program/Index/getWechatInfo', // 获取关注配置
  getPlaylistList: '/Program/Index/getPlaylistList', // 获得播单
  invitation: '/Program/Live/invitation', // 邀请统计
  getInvitationList: '/Program/Live/invitationList', // 获取邀请榜
  getChatList: '/Program/Chat/getChatList', // 获取聊天内容
  getTopChatList: '/Program/Chat/getTopChatList', // 获取置顶聊天内容
  sendChat: '/Program/Chat/sendChat', // 发送聊天
  sendPhoto: '/Program/Chat/sendPhoto', // 发送图片
  sendPhotoByWeixin: '/Program/Chat/sendPhotoByWeixin', // 微信发送图片
  getWxJsapiPackage: '/Program/Share/getWxJsapiPackage', // 获取微信sdk
  shareSuccessBack: '/Program/Share/shareSuccessBack', // 分享成功回调
  getpraisenum: '/Program/Live/getPraiseNum', // 获取点赞数
  sendPraise: '/Program/Index/praise', // 点赞
  checkPassword: '/Program/Index/checkPassword', // 加密直播间
  checkWatchList: '/Program/Live/checkWatchList', // 白名单
  getAddressForGet:
    'https://apiliveroom.dev.guangdianyun.tv/v1/Program/Address/getLivePlayAddressForGet' // 防盗链接口
};
const prodApi = {
  getWelcomePage:
    'https://1812501212048408.cn-hangzhou.fc.aliyuncs.com/2016-08-15/proxy/gdyactivity.online/live/activity/live/getWelcomePage', // 获取欢迎页配置
  getChannelInfo: 'https://golivec.guangdianyun.tv/v1/live/getinfo', // 获取直播间配置
  getChannelConfig:
    'https://1812501212048408.cn-hangzhou.fc.aliyuncs.com/2016-08-15/proxy/node-api.online/node-api/index/channelConfig', // 获取直播间配置
  getMenuList:
    'https://1812501212048408.cn-hangzhou.fc.aliyuncs.com/2016-08-15/proxy/node-api.online/node-api/live/menuList', // 获取菜单配置
  getAdvertList:
    'https://1812501212048408.cn-hangzhou.fc.aliyuncs.com/2016-08-15/proxy/node-api.online/node-api/live/advertList', // 获取广告配置
  getChatCount:
    'https://1812501212048408.cn-hangzhou.fc.aliyuncs.com/2016-08-15/proxy/gdychat.online/gdychat/program/chat/chatCount', // 获取聊天数
  getWatchNum:
    'https://1812501212048408.cn-hangzhou.fc.aliyuncs.com/2016-08-15/proxy/node-api.online/node-api/live/watchNum', // 获取观看人数
  getCaremaList: 'https://golivec.guangdianyun.tv/v1/live/getcaremalist', // 获取全景直播配置
  getWatchLoginInfo: 'https://privateapi.guangdianyun.tv/v1/Program/Index/getWatchLoginInfo', // 获取登录信息
  getWechatInfo: 'https://privateapi.guangdianyun.tv/v1/Program/Index/getWechatInfo', // 获取关注配置
  PostInfo: 'https://golivec.guangdianyun.tv/v1/live/postinfo', // 数据统计相关
  getPlaylistList: 'https://privateapi.guangdianyun.tv/v1/Program/Index/getPlaylistList', // 获得播单
  invitation: 'https://privateapi.guangdianyun.tv/v1/Program/Live/invitation', // 邀请统计
  getInvitationList: 'https://privateapi.guangdianyun.tv/v1/Program/Live/invitationList', // 获取邀请榜
  getChatList:
    'https://1812501212048408.cn-hangzhou.fc.aliyuncs.com/2016-08-15/proxy/gdychat.online/gdychat/program/chat/getChatList', // 获取聊天内容
  getTopChatList:
    'https://1812501212048408.cn-hangzhou.fc.aliyuncs.com/2016-08-15/proxy/gdychat.online/gdychat/program/chat/getTopChatList', // 获取置顶聊天内容
  sendChat:
    'https://1812501212048408.cn-hangzhou.fc.aliyuncs.com/2016-08-15/proxy/gdychat.online/gdychat/program/chat/sendChat', // 发送聊天
  sendPhoto: 'https://privateapi.guangdianyun.tv/v1/Program/Chat/sendPhoto', // 发送图片
  sendPhotoByWeixin: 'https://privateapi.guangdianyun.tv/v1/Program/Chat/sendPhotoByWeixin', // 微信发送图片
  getWxJsapiPackage: 'https://privateapi.guangdianyun.tv/v1/Program/Share/getWxJsapiPackage', // 获取微信sdk
  shareSuccessBack: 'https://privateapi.guangdianyun.tv/v1/Program/Share/shareSuccessBack', // 分享成功回调
  getpraisenum:
    'https://1812501212048408.cn-hangzhou.fc.aliyuncs.com/2016-08-15/proxy/gdychat.online/gdychat/program/praise/praiseNum', // 获取点赞数
  sendPraise:
    'https://1812501212048408.cn-hangzhou.fc.aliyuncs.com/2016-08-15/proxy/gdychat.online/gdychat/program/praise/Praise', // 点赞
  checkPassword: 'https://privateapi.guangdianyun.tv/v1/Program/Index/checkPassword', // 加密直播间
  checkWatchList: 'https://privateapi.guangdianyun.tv/v1/Program/Live/checkWatchList', // 白名单
  getAddressForGet: 'https://privateapi.guangdianyun.tv/v1/Program/Address/getLivePlayAddressForGet' // 防盗链接口
};
const preApi = {
  getWelcomePage:
    'https://1812501212048408.cn-hangzhou.fc.aliyuncs.com/2016-08-15/proxy/gdyactivity/live/activity/live/getWelcomePage', // 获取欢迎页配置
  getChannelInfo: 'https://golivec-pre.guangdianyun.tv/v1/live/getinfo', // 获取直播间配置
  getChannelConfig:
    'https://1812501212048408.cn-hangzhou.fc.aliyuncs.com/2016-08-15/proxy/node-api/node-api/index/channelConfig', // 获取直播间配置
  getMenuList:
    'https://1812501212048408.cn-hangzhou.fc.aliyuncs.com/2016-08-15/proxy/node-api/node-api/live/menuList', // 获取菜单配置
  getAdvertList:
    'https://1812501212048408.cn-hangzhou.fc.aliyuncs.com/2016-08-15/proxy/node-api/node-api/live/advertList', // 获取广告配置
  getChatCount:
    'https://1812501212048408.cn-hangzhou.fc.aliyuncs.com/2016-08-15/proxy/gdychat/gdychat/program/chat/chatCount', // 获取聊天数
  getWatchNum:
    'https://1812501212048408.cn-hangzhou.fc.aliyuncs.com/2016-08-15/proxy/node-api/node-api/live/watchNum', // 获取观看人数
  getCaremaList: 'https://golivec-pre.guangdianyun.tv/v1/live/getcaremalist', // 获取全景直播配置
  // getWatchLoginInfo: '', // 获取登录信息
  // getWechatInfo: '', // 获取关注配置
  PostInfo: 'https://golivec-pre.guangdianyun.tv/v1/live/postinfo', // 数据统计相关
  // getPlaylistList: '', // 获得播单
  // invitation: '', // 邀请统计
  // getInvitationList: '', // 获取邀请榜
  getChatList:
    'https://1812501212048408.cn-hangzhou.fc.aliyuncs.com/2016-08-15/proxy/gdychat/gdychat/program/chat/getChatList', // 获取聊天内容
  getTopChatList:
    'https://1812501212048408.cn-hangzhou.fc.aliyuncs.com/2016-08-15/proxy/gdychat/gdychat/program/chat/getTopChatList', // 获取置顶聊天内容
  sendChat:
    'https://1812501212048408.cn-hangzhou.fc.aliyuncs.com/2016-08-15/proxy/gdychat/gdychat/program/chat/sendChat', // 发送聊天
  // sendPhoto: '', // 发送图片
  // sendPhotoByWeixin: '', // 微信发送图片
  // getWxJsapiPackage: '', // 获取微信sdk
  // shareSuccessBack: '', // 分享成功回调
  getpraisenum:
    'https://1812501212048408.cn-hangzhou.fc.aliyuncs.com/2016-08-15/proxy/gdychat/gdychat/program/praise/praiseNum', // 获取点赞数
  sendPraise:
    'https://1812501212048408.cn-hangzhou.fc.aliyuncs.com/2016-08-15/proxy/gdychat/gdychat/program/praise/Praise' // 点赞
  // checkPassword: '', // 加密直播间
  // checkWatchList: '', // 白名单
  // getAddressForGet: '' // 防盗链接口
};
const testApi = {
  // getWelcomePage: '', // 获取欢迎页配置  
  getChannelInfo: 'https://goeway-dev.guangdianyun.tv/v1/live/getinfo', // 获取直播间配置
  // getChannelConfig: '', // 获取直播间配置
  getMenuList:
    'https://1812501212048408.cn-hangzhou.fc.aliyuncs.com/2016-08-15/proxy/node-api/node-api-test/live/menuList', // 获取菜单配置
  getAdvertList:
    'https://1812501212048408.cn-hangzhou.fc.aliyuncs.com/2016-08-15/proxy/node-api/node-api-test/live/advertList', // 获取广告配置
  // getChatCount: '', // 获取聊天数
  getWatchNum:
    'https://1812501212048408.cn-hangzhou.fc.aliyuncs.com/2016-08-15/proxy/node-api/node-api-test/live/watchNum', // 获取观看人数
  getCaremaList: 'https://golivec-dev.guangdianyun.tv/v1/live/getcaremalist', // 获取全景直播配置
  // getWatchLoginInfo: '', // 获取登录信息
  // getWechatInfo: '', // 获取关注配置
  PostInfo: 'https://golivec-dev.guangdianyun.tv/v1/live/postinfo' // 数据统计相关
  // getPlaylistList: '', // 获得播单
  // invitation: '', // 邀请统计
  // getInvitationList: '', // 获取邀请榜
  // getChatList: '', // 获取聊天内容
  // getTopChatList: '', // 获取置顶聊天内容
  // sendChat: '', // 发送聊天
  // sendPhoto: '', // 发送图片
  // sendPhotoByWeixin: '', // 微信发送图片
  // getWxJsapiPackage: '', // 获取微信sdk
  // shareSuccessBack: '', // 分享成功回调
  // getpraisenum: '', // 获取点赞数
  // sendPraise: '', // 点赞
  // checkPassword: '', // 加密直播间
  // checkWatchList: '', // 白名单
  // getAddressForGet: '' // 防盗链接口
};
const privateApi = {
  getChannelInfo: '/go/live/getinfo', // 获取直播间配置
  getChannelConfig: '/node/index/channelConfig', // 获取直播间配置
  getMenuList: '/node/live/menuList', // 获取菜单配置
  getAdvertList: '/node/live/advertList', // 获取广告配置
  getChatCount: '/php/program/chat/chatCount', // 获取聊天数
  getWatchNum: '/node/live/watchNum', // 获取观看人数
  getCaremaList: '/go/live/getcaremalist', // 获取全景直播配置
  PostInfo: '/go/live/postinfo', // 数据统计相关
  getChatList: '/php/program/chat/getChatList', // 获取聊天内容
  getTopChatList: '/php/program/chat/getTopChatList', // 获取置顶聊天内容
  sendChat: '/php/program/chat/sendChat', // 发送聊天
  getpraisenum: '/php/program/praise/praiseNum', // 获取点赞数
  sendPraise: '/php/program/praise/Praise', // 点赞
  getAddressForGet: `https:${
    process.env.DEF_DOMAIM + process.env.HTTPS_PORT
  }/v1/Program/Address/getLivePlayAddressForGet` // 防盗链接口
};
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 };
  }
} else {
  api = { ...api, ...privateApi };
}

export const getDrainage = data => {
  return request.get(api['getDrainage'], data);
};
export const getDrainageStatus = data => {
  return request.get(api['getDrainageStatus'], data);
};
export const getWelcomePage = data => {
  return request.get(api['getWelcomePage'], data);
};
export const getChannelInfo = data => {
  return request.get(api['getChannelInfo'], data);
};
export const getChannelConfig = data => {
  return request.get(api['getChannelConfig'], data);
};
export const getMenuList = data => {
  return request.get(api['getMenuList'], data);
};
export const getAdvertList = data => {
  return request.get(api['getAdvertList'], data);
};
export const getChatCount = data => {
  return request.get(api['getChatCount'], data);
};
export const getWatchNum = data => {
  return request.get(api['getWatchNum'], data);
};
export const getCaremaList = data => {
  return request.get(api['getCaremaList'], data);
};
export const getWatchLoginInfo = data => {
  return request.get(api['getWatchLoginInfo'], data);
};
export const getWechatInfo = data => {
  return request.get(api['getWechatInfo'], data);
};
export const PostInfo = data => {
  return request.post(api['PostInfo'], data);
};
export const getPlaylistList = data => {
  return request.get(api['getPlaylistList'], data);
};
export const invitation = data => {
  return request.post(api['invitation'], data, { headers: { noMsg: 1 } });
};
export const getInvitationList = data => {
  return request.get(api['getInvitationList'], data);
};
export const getChatList = data => {
  return request.get(api['getChatList'], data);
};
export const getTopChatList = data => {
  return request.get(api['getTopChatList'], data);
};
export const sendChat = data => {
  return request.post(api['sendChat'], data);
};
export const sendPhoto = data => {
  return request.post(api['sendPhoto'], data);
};
export const sendPhotoByWeixin = data => {
  return request.post(api['sendPhotoByWeixin'], data);
};
export const getWxJsapiPackage = data => {
  return request.post(api['getWxJsapiPackage'], data);
};
export const shareSuccessBack = data => {
  return request.post(api['shareSuccessBack'], data);
};
export const getpraisenum = data => {
  return request.get(api['getpraisenum'], data);
};
export const sendPraise = data => {
  return request.post(api['sendPraise'], data);
};
export const checkPassword = data => {
  return request.post(api['checkPassword'], data);
};
export const checkWatchList = data => {
  return request.post(api['checkWatchList'], data);
};
export const getAddressForGet = () => {
  return api['getAddressForGet'];
};
export default {
  getDrainageStatus,
  getDrainage,
  getWelcomePage,
  getChannelInfo,
  getChannelConfig,
  getMenuList,
  getAdvertList,
  getChatCount,
  getWatchNum,
  getCaremaList,
  getWatchLoginInfo,
  getWechatInfo,
  PostInfo,
  getPlaylistList,
  invitation,
  getInvitationList,
  getChatList,
  getTopChatList,
  sendChat,
  sendPhoto,
  sendPhotoByWeixin,
  getWxJsapiPackage,
  shareSuccessBack,
  getpraisenum,
  sendPraise,
  checkPassword,
  checkWatchList,
  getAddressForGet
};
