var prefix = process.car.PREFIX+'-' + process.car.NODE_ENV + '_';

var app = {
	
	
	getPrefix:()=> prefix,
	get : key =>  uni.getStorageSync(prefix + key),

	set : (key, value) => uni.setStorageSync(prefix + key, value),
	remove: key =>  uni.removeStorageSync(prefix + key),
	
	
	logoff:()=>{
		uni.removeStorageSync(prefix + 'token_tdate')
		uni.removeStorageSync(prefix + 'token')
		uni.removeStorageSync(prefix  + 'personInfo');
		uni.removeStorageSync(prefix + 'personInfoPlus');
	//	uni.removeStorageSync(prefix + 'getElderModeClass');
		//uni.removeStorageSync(prefix+'wx_openId');
		
	},
	
	getPersonInfo : () => {
		 return uni.getStorageSync(prefix + 'personInfo')
	},
	getPersonInfoPlus : () => {
		 return uni.getStorageSync(prefix + 'personInfoPlus')
	},
	signOut:()=>  uni.removeStorageSync(prefix  + 'personInfo'),
	getOpenId : () =>   uni.getStorageSync(prefix + 'wx_openId'+process.car.VUE_APP_WXAPPID),
	setOpenId : (value) => uni.setStorageSync(prefix + 'wx_openId'+process.car.VUE_APP_WXAPPID, value),
	
	getOpenIdALI : () =>   uni.getStorageSync(prefix + 'ali_openId'+process.car.VUE_APP_WXAPPID),
	setOpenIdALI : (value) => uni.setStorageSync(prefix + 'ali_openId'+process.car.VUE_APP_WXAPPID, value),
	
	getUserInfo : () => {
		 return uni.getStorageSync(prefix + 'xpgj_wx_user_info')
	},

	setPersonInfo : (value) => uni.setStorageSync(prefix + 'personInfo', value),
	setPersonInfoPlus : (value) => uni.setStorageSync(prefix + 'personInfoPlus', value),
	
	setUserInfo : (value) => uni.setStorageSync(prefix + 'xpgj_wx_user_info', value),
	
	getToken : (options) => {
		//不同权限 ，不同token
	
		return uni.getStorageSync(prefix + 'token')
	},
	setToken : (value) => {
		uni.setStorageSync(prefix + 'token', value)
		
		if(value){
			var tdate=new Date( +new Date() + 8 * 3600 * 1000 ).toJSON().substr(0,13).replace("T"," ")
			uni.setStorageSync(prefix + 'token_tdate', tdate)
		}
	}
	
}

module.exports = app
