import httpRequest from '@/module/request/http-request.js'
import ipConfig from '@/config/ip.config.js'

const api = {
	getGameCategoryList: ipConfig.api_app + '/labelGame/list',
	getGameAndCategoryByLabel: ipConfig.api_app + '/labelGame/getGameAndCategoryByLabel',
	getRecentGames: ipConfig.api_app + '/labelGame/getRecentGames',
	getFavoriteGames: ipConfig.api_app + '/labelGame/getFavoriteGames',
	favoriteGame: ipConfig.api_app + '/labelGame/favoriteGame',
	getGameUrlByGame: ipConfig.api_app + '/labelGame/getGameUrlByGame',
	openGameSearch: ipConfig.api_app + '/labelGame/openGameSearch',
	getGameByCategoryAndPage: ipConfig.api_app + '/labelGame/getGameByCategoryAndPage',
	getSearchResults: ipConfig.api_app + '/labelGame/getSearchResults',
	jiliLogout: ipConfig.api_app + '/jili/transfer/logout',
	gameOut: ipConfig.api_app + '/labelGame/logoutGame',
}

export const gameOutApi = () => {
	return httpRequest.post({
		url: api.gameOut,
		data: {}
	})
}
/**
 * 获取标签
 */
export const requestGameCategoryList = (params) => {
	return httpRequest.post({
		url: api.getGameCategoryList,
		data: params
	})
}

/**
 * 根据标签获取游戏和分类
 */
export const requestGetGameAndCategoryByLabel = (params) => {
	return httpRequest.post({
		url: api.getGameAndCategoryByLabel,
		data: params
	})
}

/**
 * 获取最近游戏
 */
export const requestRecentGameList = (params) => {
	return httpRequest.post({
		url: api.getRecentGames,
		data: params
	})
}

/**
 * 获取收藏游戏
 */
export const requestFavoriteGameList = (params) => {
	return httpRequest.post({
		url: api.getFavoriteGames,
		data: params
	})
}

/**
 * 收藏游戏
 */
export const requestFavoriteGame = (params) => {
	return httpRequest.post({
		url: api.favoriteGame,
		data: params
	})
}

/**
 * 根据游戏id获取游戏进入url
 */
export const requestGetGameUrlByGame = (params) => {
	return httpRequest.post({
		url: api.getGameUrlByGame,
		data: params
	})
}

/**
 * 打开游戏搜索
 */
export const requestOpenGameSearch = (params) => {
	return httpRequest.post({
		url: api.openGameSearch,
		data: params
	})
}

/**
 * 获取游戏分页
 */
export const requestGetGameByCategoryAndPage = (params) => {
	return httpRequest.post({
		url: api.getGameByCategoryAndPage,
		data: params
	})
}

/**
 * 搜索游戏结果
 */
export const requestSearchResults = (params) => {
	return httpRequest.post({
		url: api.getSearchResults,
		data: params
	})
}

/**
 * jili游戏退出调用
 */
export const requestJiliLogout = (params) => {
	return httpRequest.post({
		url: api.jiliLogout,
		data: params
	})
}

