|
@@ -3,6 +3,7 @@ package com.grkj.iscs.util
|
|
|
import android.content.Context
|
|
import android.content.Context
|
|
|
import com.google.gson.Gson
|
|
import com.google.gson.Gson
|
|
|
import com.google.gson.reflect.TypeToken
|
|
import com.google.gson.reflect.TypeToken
|
|
|
|
|
+import com.grkj.iscs.model.UrlConsts
|
|
|
import com.grkj.iscs.model.bo.UpdateKeyReturnBO
|
|
import com.grkj.iscs.model.bo.UpdateKeyReturnBO
|
|
|
import com.grkj.iscs.model.vo.card.CardInfoRespVO
|
|
import com.grkj.iscs.model.vo.card.CardInfoRespVO
|
|
|
import com.grkj.iscs.model.vo.system.SystemAttributePageRespVO
|
|
import com.grkj.iscs.model.vo.system.SystemAttributePageRespVO
|
|
@@ -15,6 +16,7 @@ object SPUtils {
|
|
|
private const val SP_CONFIG_NAME = "iscs_config"
|
|
private const val SP_CONFIG_NAME = "iscs_config"
|
|
|
private const val SP_DATA = "iscs_data"
|
|
private const val SP_DATA = "iscs_data"
|
|
|
private const val SP_ATTRIBUTE = "iscs_attribute"
|
|
private const val SP_ATTRIBUTE = "iscs_attribute"
|
|
|
|
|
+ private const val SP_URL = "iscs_url"
|
|
|
|
|
|
|
|
private const val KEY_LOGIN_USER_CARD_ID = "card_id"
|
|
private const val KEY_LOGIN_USER_CARD_ID = "card_id"
|
|
|
private const val KEY_LOGIN_USER_CARD_CODE = "card_code"
|
|
private const val KEY_LOGIN_USER_CARD_CODE = "card_code"
|
|
@@ -32,6 +34,7 @@ object SPUtils {
|
|
|
private const val KEY_DATA_UPDATE_KEY_RETURN = "update_key_return"
|
|
private const val KEY_DATA_UPDATE_KEY_RETURN = "update_key_return"
|
|
|
|
|
|
|
|
private const val KEY_SYSTEM_ATTRIBUTE = "system_attribute"
|
|
private const val KEY_SYSTEM_ATTRIBUTE = "system_attribute"
|
|
|
|
|
+ private const val KEY_BASE_URL = "base_url"
|
|
|
|
|
|
|
|
fun getLoginUser(context: Context): CardInfoRespVO? {
|
|
fun getLoginUser(context: Context): CardInfoRespVO? {
|
|
|
val sp = context.getSharedPreferences(SP_NAME, Context.MODE_PRIVATE)
|
|
val sp = context.getSharedPreferences(SP_NAME, Context.MODE_PRIVATE)
|
|
@@ -214,4 +217,20 @@ object SPUtils {
|
|
|
}
|
|
}
|
|
|
return list.find { it.sysAttrKey == key }?.sysAttrValue
|
|
return list.find { it.sysAttrKey == key }?.sysAttrValue
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ fun saveBaseUrl(context: Context, url: String) {
|
|
|
|
|
+ val sp = context.getSharedPreferences(SP_URL, Context.MODE_PRIVATE)
|
|
|
|
|
+ val edit = sp.edit()
|
|
|
|
|
+ edit.putString(KEY_BASE_URL, url)
|
|
|
|
|
+ edit.commit()
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ fun getBaseUrl(context: Context): String {
|
|
|
|
|
+ val sp = context.getSharedPreferences(SP_URL, Context.MODE_PRIVATE)
|
|
|
|
|
+ val spUrl = sp.getString(KEY_BASE_URL, null)
|
|
|
|
|
+ if (spUrl.isNullOrEmpty()) {
|
|
|
|
|
+ return UrlConsts.BASE_URL
|
|
|
|
|
+ }
|
|
|
|
|
+ return spUrl
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|