import httpRequest from '@/utils/axios'
/**
 * 操作日志
 */
export function operateLog(params) {
  const logMsg = `操作人：${params.user.nickname}，操作：${params.type}`
  const data = {
    detail: logMsg
  }
  httpRequest.post('/api/live/admin/v2/system/log/write', data).then(res => {
  }).catch(() => {})
}
/**
 * 模糊搜索
 */
export function searchUserList(params) {
  return httpRequest.get('/api/live/common/v1/sso-user/search', { params })
}
/**
 * 创建腾讯用户
 */
export function createAccount(data) {
  return httpRequest.post('/api/live/admin/v2/tencent/user', data)
}
/**
 * 获取腾讯用户列表(分页)
 */
export function getAccountList(params) {
  return httpRequest.get('/api/live/admin/v2/tencent/users', { params })
}
/**
 * 获取腾讯用户列表(不分页)
 */
export function getAllAccountList() {
  return httpRequest.get('/api/live/admin/v2/tencent/user/list')
}
/**
 * 更新腾讯用户
 */
export function updateAccount(data) {
  return httpRequest.put(`/api/live/admin/v2/tencent/user/${data.userid}/update`, data)
}
/**
 * 删除腾讯用户
 */
export function deleteAccount(params) {
  return httpRequest.delete(`/api/live/admin/v2/tencent/user/${params.userid}/delete`, params)
}
/**
 * 创建会议
 */
export function createMeeting(data) {
  return httpRequest.post('/api/live/admin/v2/tencent/meeting', data)
}
/**
 * 创建会议
 */
export function updateMeeting(data) {
  return httpRequest.put(`/api/live/admin/v2/tencent/meeting/${data.meeting_id}/update`, data)
}
/**
 * 获取腾讯会议列表
 */
export function getMeetingList(params) {
  return httpRequest.get('/api/live/admin/v2/tencent/meetings', { params })
}
/**
 * 获取腾讯会议列表（不分页）
 */
export function getNonpagedMeetingList(params) {
  return httpRequest.get('/api/live/admin/v2/tencent/meeting/list-by-day', { params })
}
/**
 * 获取腾讯会议详情
 */
export function getMeetingDetails(params) {
  return httpRequest.get(`/api/live/admin/v2/tencent/meeting/${params.meeting_id}/detail`, { params })
}
/**
 * 通过会议code获取腾讯会议详情
 */
export function getMeetingDetailsByCode(params) {
  return httpRequest.get(`/api/live/admin/v2/tencent/meeting/${params.meeting_code}/detail-code`, { params })
}
/**
 * 取消(删除)会议
 */
export function cancelMeeting(params) {
  return httpRequest.post(`/api/live/admin/v2/tencent/meeting/${params.meeting_id}/cancel`, params)
}
/**
 * 终止会议
 */
export function stopMeeting(params) {
  return httpRequest.post(`/api/live/admin/v2/tencent/meeting/${params.meeting_id}/dimiss`, params)
}
/**
 * 获取回放地址
 */
export function getMeetingRecordAddr(params) {
  return httpRequest.post(`/api/live/admin/v2/tencent/meeting/${params.meeting_id}/records/address`, params)
}
/**
 * 导出参会人员
 */
export function exportParticipants(params) {
  return httpRequest({
    url: `/api/live/admin/v2/tencent/meeting/${params.meeting_id}/participants/export`,
    method: 'get',
    params,
    responseType: 'blob'
  })
}
