import request from '@/utils/request'
import Qs from 'qs'

export function listNews(query) {
  return request({
    method: 'get',
    params: {
      _gp: 'admin.news',
      _mt: 'list',
      ...query
    }
  })
}

export function createNews(data) {
  return request({
    method: 'post',
    data: Qs.stringify({
      _gp: 'admin.news',
      _mt: 'create',
      ...data
    })
  })
}

export function updateNews(data) {
  return request({
    method: 'post',
    data: Qs.stringify({
      _gp: 'admin.news',
      _mt: 'edit',
      ...data
    })
  })
}

export function deleteNews(id) {
  return request({
    method: 'post',
    params: {
      _gp: 'admin.news',
      _mt: 'delete',
      id: id
    }
  })
}
