 class API {
	constructor(url,req) {
		const map={
			add:'POST',
			del:'DELETE',
			update:'PUT',
			get:'GET'
		} 
		this.url=url
		for(let key in map){
			this[key]=function(data){
				 data=Array.isArray(data)?data:{...data,shopId:uni.getStorageSync('shopId')}
				 if(key==='del'){
					 delete data.shopId
				 }
				return req(url, data,map[key])
			}
		}
	}
}

export default API