// const BASE_URL='http://8.136.98.49:8002'
let BASE_URL = ''
export const myRequest = (options) => {
	// BASE_URL = uni.getStorageSync('http')
	BASE_URL = 'http://182.92.193.64:8002'
	// BASE_URL = 'http://192.168.1.17:8000'
	if (BASE_URL == '') {
		BASE_URL = 'http://8.136.98.49:8002'
	}
	console.log(BASE_URL)
	var session_key = ""
	session_key = uni.getStorageSync('session_key')
	let url = options.url
	let data = options.data || {}
	if (url != 'back_source.production.operator_login') {
		data.token = session_key
	}
	return new Promise((resolve, reject) => {
		uni.request({
			url: BASE_URL + options.url,
			method: options.method || 'POST',
			timeout:30000,
			header: {
				"Content-Type": "application/x-www-form-urlencoded",
			},
			data: data,
			success: (res) => {
				if (res.data.message != "") {
					return uni.showToast({
						title: res.data.message,
						icon: "none",
					})
				}
				resolve(res.data.data)
			},
			fail: (err) => {
				uni.showToast({
					title: '请求接口失败',
					icon:'none',
				})
				reject(err)
			}
		})
	})
}
