const SESSION_KEY = 'fingertip_manager_session' const LOGIN_PREFERENCE_KEY = 'jayucloud_salon_login_preference' const PHONE_BANNER_DISMISSED_KEY = 'jayucloud_salon_phone_banner_dismissed' const PROFILE_PROMPT_SKIPPED_KEY = 'jayucloud_salon_profile_prompt_skipped' function getSession() { try { return wx.getStorageSync(SESSION_KEY) || {} } catch (error) { return {} } } function setSession(session) { wx.setStorageSync(SESSION_KEY, session || {}) } function clearSession() { wx.removeStorageSync(SESSION_KEY) } function getAccessToken() { const session = getSession() return session.accessToken || session.token || '' } function getLoginPreference() { try { return wx.getStorageSync(LOGIN_PREFERENCE_KEY) || {} } catch (error) { return {} } } function setLoginPreference(preference) { wx.setStorageSync(LOGIN_PREFERENCE_KEY, preference || {}) } function clearLoginPreference() { wx.removeStorageSync(LOGIN_PREFERENCE_KEY) } function clearDeviceLoginState() { clearSession() clearLoginPreference() wx.removeStorageSync(PHONE_BANNER_DISMISSED_KEY) wx.removeStorageSync(PROFILE_PROMPT_SKIPPED_KEY) } module.exports = { getSession, setSession, clearSession, getAccessToken, getLoginPreference, setLoginPreference, clearLoginPreference, clearDeviceLoginState, PHONE_BANNER_DISMISSED_KEY, PROFILE_PROMPT_SKIPPED_KEY }