import request from '@/utils/request'

export function fetchList(query) {
  return request({
    url: '/transactions',
    method: 'get',
    params: query
  })
}

// 查询 活动详情
export function transactionById(id) {
  return request({
    url: '/transaction/' + id,
    method: 'get'
  })
}

// 作废 活动详情
export function updateTransactionById(id) {
  return request({
    url: '/transaction/update/' + id,
    method: 'post'
  })
}
// 帖子列表
export function transactionsList(data) {
  return request({
    url: '/transactions',
    method: 'post',
    data: {
      transactionTitle: data.transactionTitle,
      id: data.id,
      userName: data.userName,
      status: data.status,
      pageNum: data.pageNum,
      pageSize: data.pageSize
    }
  })
}
// 添加二手帖子
export function transactionsAdd(data) {
  return request({
    url: '/transactions/add',
    method: 'post',
    data: {
      transactionTitle: data.transactionTitle,
      type: data.type,
      id: data.id,
      userName: data.userName,
      status: data.status,
      contentImg: data.contentImg,
      transactionContent: data.transactionContent,
      sort: data.sort
    }
  })
}
// 编辑二手帖子
export function transactionsEdit(data) {
  return request({
    url: '/transactions/updata',
    method: 'post',
    data: {
      transactionTitle: data.transactionTitle,
      type: data.type,
      id: data.id,
      userName: data.userName,
      status: data.status,
      contentImg: data.contentImg,
      transactionContent: data.transactionContent,
      sort: data.sort
    }
  })
}
// 删除二手帖子
export function transactionsDelete(data) {
  console.log('1111')
  console.log(data)
  return request({
    url: '/transactions/delete',
    method: 'post',
    data: {
      id: data
    }
  })
}
// 评论列表
export function transactionReplyList(data) {
  return request({
    url: '/transactionReplyList',
    method: 'post',
    data: {
      id: data.transactionId,
      replyTaUserName: data.replyTaUserName,
      taUserName: data.taUserName,
      status: data.status,
      pageNum: data.pageNum,
      pageSize: data.pageSize,
      createDate: data.dataValue
    }
  })
}
// 删除评论
export function deleteReply(data) {
  console.log(data)
  return request({
    url: '/deleteReply',
    method: 'post',
    data: {
      id: data
    }
  })
}
// 添加评论
export function transactionReplyAdd(data) {
  return request({
    url: '/transactionReply/add',
    method: 'post',
    data: {
      id: data.id,
      contentImg: data.contentImg,
      replyContent: data.replyContent,
      transactionId: data.transactionId,
      replyType: data.replyType
    }
  })
}
// 举报列表
export function transactionReportList(data) {
  return request({
    url: '/transactionReportList',
    method: 'post',
    data: {
      transactionId: data.transactionId,
      reportPhone: data.reportPhone,
      reportUserNmae: data.taUserName,
      pageNum: data.pageNum,
      pageSize: data.pageSize,
      createDate: data.dataValue
    }
  })
}
