//我的相关:
const {
	http
} = uni.$u


//测试接口
export const login = (params, config = {}) => http.post('/auth/mini_program', params, config)
export const getUserInfo = (params, config = {}) => http.get('/user/info', params, config)
export const updateUserInfo = (params, config = {}) => http.post('/user/update', params, config)
export const getTuijian = (params, config = {}) => http.get('/user/myShare', params, config)



export const getChargeRecord = (params, config = {}) => http.get('/user/myOrderList', params, config)
export const getConsumerRecord = (params, config = {}) => http.get('/user/myConsumeList', params, config)



// export const getJingxuan = (params, config = {}) => http.get('/getHandpick', params, config)

export const getJingxuan = (params, config = {}) => {

	let apiUrl = '/getHandpick'
	Object.keys(params).forEach((item, index) => {
		if (index == 0) {
			apiUrl += `?${item}=${params[item]}`
		} else {
			apiUrl += `&${item}=${params[item]}`
		}
	})
	console.log('处理后的apiUrl', apiUrl);
	return http.get(apiUrl, params, config)
}



export const getRoleparmas = (params, config = {}) => http.get('/user/myRoleList', params, config)


export const postTask = (params, config = {}) => http.post('/ai/submitTask', params, config)


// export const getGenRes = (params, config = {}) => http.get('/ai/getTaskDetail', params, config)


export const getGenRes = (params, config = {}) => {

	let apiUrl = '/ai/getTaskDetail'
	Object.keys(params).forEach((item, index) => {
		if (index == 0) {
			apiUrl += `?${item}=${params[item]}`
		} else {
			apiUrl += `&${item}=${params[item]}`
		}
	})
	console.log('处理后的apiUrl', apiUrl);
	return http.get(apiUrl, params, config)
}



export const getbanner = (params, config = {}) => http.get('/banner', params, config)


export const getyonghu = (params, config = {}) => http.get('/agreement', params, config)
// export const getyonghu1 = (params, config = {}) => http.get('/privacy', params, config)


export const getyinsi = (params, config = {}) => http.get('/privacy', params, config)


// 暂无接口--隐私协议
export const getabout = (params, config = {}) => http.get('/privacy', params, config)




// export const genPdf = (params, config = {}) => http.post('/ai/generate_pdf', params, config)

export const genPdf = (params, config = {}) => {

	let apiUrl = '/ai/downloadPdf'
	Object.keys(params).forEach((item, index) => {
		if (index == 0) {
			apiUrl += `?${item}=${params[item]}`
		} else {
			apiUrl += `&${item}=${params[item]}`
		}
	})
	console.log('处理后的apiUrl', apiUrl);
	return http.get(apiUrl, params, config)
}



export const postZhaomu = (params, config = {}) => http.post('/user/applyShare', params, config)



export const payConfig = (params, config = {}) => http.get('/payConfig', params, config)



// 下单接口待实现
export const submitOrder = (params, config = {}) => http.post('/user/recharge/create/order', params, config)




export const getTeam = (params, config = {}) => http.get('/user/myTeam', params, config)


export const getYongjinList = (params, config = {}) => http.get('/user/myGiveaway', params, config)




export const userWithdraw = (params, config = {}) => http.post('/user/userWithdraw', params, config)



export const cashList = (params, config = {}) => http.get('/user/userWithdrawList', params, config)




export const getKefu = (params, config = {}) => http.get('/getServiceConfig', params, config)



export const addTeam = (params, config = {}) => http.post('/user/userWithdraw', params, config)


export const getCode = (params, config = {}) => http.get('/user/getUserRqCode', params, config)



export const getPosterBg = (params, config = {}) => {

	let apiUrl = '/getConfigByKey'
	Object.keys(params).forEach((item, index) => {
		if (index == 0) {
			apiUrl += `?${item}=${params[item]}`
		} else {
			apiUrl += `&${item}=${params[item]}`
		}
	})
	console.log('处理后的apiUrl', apiUrl);
	return http.get(apiUrl, params, config)
}



export const postAddRole = (params, config = {}) => http.post('/user/addRole', params, config)
export const postUpRole = (params, config = {}) => http.post('/user/updateRole', params, config)
export const postDelRole = (params, config = {}) => http.post('/user/deleteRole', params, config)