import request from '/@/utils/request';

// 获取新闻列表
export const getNews = (params: any) => {
	return request({
		url: '/news',
		method: 'get',
		params,
	});
};

// 获取新闻列表
export const doNewsPublish = (data: any) => {
	return request({
		url: '/news/publish',
		method: 'post',
		data,
	});
};

// 撤稿
export const doNewRevoke = (data: any) => {
	return request({
		url: '/news/revoke',
		method: 'post',
		data,
	});
};

// 获取新闻列表
export const getSsoUrl = (data: any) => {
	return request({
		url: '/common/uploadKey',
		method: 'post',
		data,
	});
};

// 来源标签搜索接口
export const getTagSource = (params: any) => {
	return request({
		url: '/tag/source',
		method: 'get',
		params,
	});
};

// 来源标签新增
export const addTagSource = (data: any) => {
	return request({
		url: '/tag/source/create',
		method: 'post',
		data,
	});
};

// 来源标签编辑
export const updateTagSource = (data: any) => {
	return request({
		url: '/tag/source/update',
		method: 'post',
		data,
	});
};

// 来源标签删除
export const deleteTagSource = (data: any) => {
	return request({
		url: '/tag/source/delete',
		method: 'post',
		data,
	});
};

// 频道标签新增
export const addTagDiy = (data: any) => {
	return request({
		url: '/tag/diy/create',
		method: 'post',
		data,
	});
};

// 频道标签编辑
export const updateTagDiy = (data: any) => {
	return request({
		url: '/tag/diy/update',
		method: 'post',
		data,
	});
};

// 频道标签删除
export const deleteTagDiy = (data: any) => {
	return request({
		url: '/tag/diy/delete',
		method: 'post',
		data,
	});
};

// 自定义标签搜索接口
export const getTagDiy = (params: any) => {
	return request({
		url: '/tag/diy',
		method: 'get',
		params,
	});
};

// 栏目搜索接口
export const getColumn = (params: any) => {
	return request({
		url: '/column',
		method: 'get',
		params,
	});
};

// 新闻保存
export const doNewsSave = (data: any) => {
	return request({
		url: '/news/save',
		method: 'post',
		data,
	});
};

// 新闻发布
export const doNewsCreatePublish = (data: any) => {
	return request({
		url: '/news/create/publish',
		method: 'post',
		data,
	});
};

// 快讯列表
export const getNewsFast = (data: any) => {
	return request({
		url: '/news/fast',
		method: 'post',
		data,
	});
};

// 新闻详情
export const getNewsDetail = (params: any) => {
	return request({
		url: '/news/detail',
		method: 'get',
		params,
	});
};

// 新闻详情
export const getColumnVIP = (params: any) => {
	return request({
		url: '/column/vip',
		method: 'get',
		params,
	});
};

// 新闻详情
export const doDeleteNews = (params: any) => {
	return request({
		url: '/news',
		method: 'delete',
		params,
	});
};

// 行业分类搜索接口
export const getIndustrySearch = (params: any) => {
	return request({
		url: '/industry',
		method: 'get',
		params,
	});
};
// 行业分类创建接口
export const getIndustryCreate = (data: any) => {
	return request({
		url: '/industry/create',
		method: 'post',
		data,
	});
};
// 行业分类删除接口
export const getIndustryDel = (data: any) => {
	return request({
		url: '/industry/delete',
		method: 'post',
		data,
	});
};

// 行业分类更新接口
export const getIndustryUpdate = (data: any) => {
	return request({
		url: '/industry/update',
		method: 'post',
		data,
	});
};

// 全量资讯库 -----------------------------------------------

// 全量资讯库分页搜索接口
export const getNewsInfo = (params: any, headers?: any) => {
	return request({
		url: '/newsinfo',
		method: 'get',
		params,
		headers,
	});
};

// 全量资讯详情
export const getNewsInfoDetail = (params: any) => {
	return request({
		url: '/newsinfo/detail',
		method: 'get',
		params,
	});
};

// 全量资讯发布接口
export const getNewsInfoPublish = (data: any) => {
	return request({
		url: '/newsinfo/publish',
		method: 'post',
		data,
	});
};

// 删除接口
export const delNewsInfo = (params: any) => {
	return request({
		url: '/newsinfo/delete',
		method: 'post',
		params,
	});
};

// 全量资讯创建和编辑保存接口
export const getNewsInfoSave = (data: any) => {
	return request({
		url: '/newsinfo/save',
		method: 'post',
		data,
	});
};

// 全量资讯库 -----------------------------------------------

// 获取资讯评分详情接口
export const getNewsScore = (params: any) => {
	return request({
		url: '/news/score',
		method: 'get',
		params,
	});
};

// 获取资讯评分详情接口(全量)
export const getNewsInfoScore = (params: any) => {
	return request({
		url: '/newsinfo/score',
		method: 'get',
		params,
	});
};

// 获取行业层级接口
export const getIndustryHierarchy = (params?: any) => {
	return request({
		url: '/industry/hierarchy',
		method: 'get',
		params,
	});
};

export const getTagConcept = (params?: any) => {
	return request({
		url: '/tag/concept',
		method: 'get',
		params,
	});
};

// 资讯精选翻译比对接口
export const getTranslator = (params?: any) => {
	return request({
		url: '/news/' + params.id + '/translator',
		method: 'get',
	});
};

// 恢复已删除资讯接口
export const doRecover = (data?: any) => {
	return request({
		url: '/news/' + data.id + '/recover',
		method: 'post',
	});
};

// 资讯送审接口
export const doNewSubmit = (data?: any) => {
	return request({
		url: '/news/submit',
		method: 'post',
		data,
	});
};

// // 资讯撤审接口
// export const doNewRevoke = (data?: any) => {
// 	return request({
// 		url: '/news/revoke',
// 		method: 'post', data
// 	});
// };

// 操作日志
export const doNewLog = (params?: any) => {
	return request({
		url: '/news/log',
		method: 'get',
		params,
	});
};

// 复审
export const doNewCheck = (params?: any) => {
	return request({
		url: '/news/check',
		method: 'post',
		params,
	});
};

// 退改
export const doNewReturn = (params?: any) => {
	return request({
		url: '/news/return',
		method: 'post',
		params,
	});
};

// 筛选项-获取信号规则级联列表
export const getSignalRules = (params?: any) => {
	return request({
		url: '/news/getSignalRulesList',
		method: 'get',
		params,
	});
};

export const searchCompany = (params?: any) => {
	return request({
		url: '/news/getCompanyNames',
		method: 'get',
		params,
	});
};

export const getRealTotal = (params?: any) => {
	return request({
		url: '/news/getRealTotal',
		method: 'get',
		params,
	});
};
