import api from '@/utils/request'

export const iGetList = params => api.post(`/admin/tag/page`, params)

export const iGetItem = ({ id, ...params }) => api.get(`/admin/tag/item/${id}`, params)

export const iGetNotUsed = ({ moduleType, ...params }) => api.post(`/admin/tag/count/${moduleType}`, params)

export const iUpdateItem = (id, params) => api.put(`/admin/tag/item/${id}`, params)

export const iAddItem = params => api.post(`/admin/tag/item`, params)

export const iChangeShowStatus = ({ id, ...params }) => api.get(`/admin/tag/${id}/changeShow`, params)

export const iDeleteTag = ({ id, ...params }) => api.del(`/admin/tag/delete/${id}`, params)

export const iDeleteTags = data => api.delData(`/admin/tag/list/delete`, data, { dataType: 'json' })

export const iGetTagList = params => api.post(`/admin/tag/list`, params)

// 非本表操作

export const iGetArticleList = ({ tagId, ...params }) => api.post(`/admin/article/page/tag/${tagId}`, params)

export const iDeleteTagInArticle = ({ id, ...params }) => api.del(`/admin/article/tag/relation/${id}`, params)

export const iDeleteTagsInArticle = params => api.delData(`/admin/article/tag/relation`, params)
