refactor(network): 移除设备认证和登录相关API接口
- 注释掉设备获取token的API接口和服务端点 - 移除设备信息查询相关的API接口和服务端点 - 删除登录功能的API接口和服务端点 - 移除部分收货功能的API接口和服务端点 - 注释掉添加物品采购单位的API接口和服务端点 - 相应移除ViewModel中的设备认证和登录逻辑 - 删除Repository中对应的网络请求方法
This commit is contained in:
@@ -27,29 +27,29 @@ class DeviceViewModel @Inject constructor(
|
||||
/**
|
||||
* 获取token
|
||||
*/
|
||||
fun getDeviceToken(deviceId: String = GlobalData.deviceId) {
|
||||
launchWithLoading {
|
||||
val response = repository.getDeviceToken(deviceId)
|
||||
if (parseResponse(response)) {
|
||||
val response1 = repository.getDeviceInfo(deviceId, response.result!!)
|
||||
|
||||
if (parseResponse(response1)) {
|
||||
val equipmentInfo = response1.result
|
||||
if (equipmentInfo == null) return@launchWithLoading
|
||||
try {
|
||||
parseEquipmentInfo(equipmentInfo)
|
||||
SPUtil.getInstance()
|
||||
.put(GlobalKey.KEY_EQUIPMENT_INFO, GsonUtils.toJson(equipmentInfo))
|
||||
_deviceInfoResult.value = true
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e)
|
||||
}
|
||||
} else {
|
||||
//ToastUtils.showToast("获取设备信息失败")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// fun getDeviceToken(deviceId: String = GlobalData.deviceId) {
|
||||
// launchWithLoading {
|
||||
// val response = repository.getDeviceToken(deviceId)
|
||||
// if (parseResponse(response)) {
|
||||
// val response1 = repository.getDeviceInfo(deviceId, response.result!!)
|
||||
//
|
||||
// if (parseResponse(response1)) {
|
||||
// val equipmentInfo = response1.result
|
||||
// if (equipmentInfo == null) return@launchWithLoading
|
||||
// try {
|
||||
// parseEquipmentInfo(equipmentInfo)
|
||||
// SPUtil.getInstance()
|
||||
// .put(GlobalKey.KEY_EQUIPMENT_INFO, GsonUtils.toJson(equipmentInfo))
|
||||
// _deviceInfoResult.value = true
|
||||
// } catch (e: Exception) {
|
||||
// Timber.e(e)
|
||||
// }
|
||||
// } else {
|
||||
// //ToastUtils.showToast("获取设备信息失败")
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* 检查缓存数据
|
||||
|
||||
@@ -39,16 +39,16 @@ class UserViewModel @Inject constructor(
|
||||
//}
|
||||
}
|
||||
|
||||
fun login(userName: String, password: String) = launchWithLoading {
|
||||
val loginParam = LoginParam(userName = userName, password = password)
|
||||
val response = repo.login(loginParam)
|
||||
if (parseResponse(response)) {
|
||||
SPUtil.getInstance().put(GlobalKey.KEY_USER_NAME, userName)
|
||||
_user.value = response.result
|
||||
saveToken(response.result)
|
||||
response.result?.token
|
||||
}
|
||||
}
|
||||
// fun login(userName: String, password: String) = launchWithLoading {
|
||||
// val loginParam = LoginParam(userName = userName, password = password)
|
||||
// val response = repo.login(loginParam)
|
||||
// if (parseResponse(response)) {
|
||||
// SPUtil.getInstance().put(GlobalKey.KEY_USER_NAME, userName)
|
||||
// _user.value = response.result
|
||||
// saveToken(response.result)
|
||||
// response.result?.token
|
||||
// }
|
||||
// }
|
||||
|
||||
fun getUserInfo() {
|
||||
val userInfo = SPUtil.getInstance().get(GlobalKey.KEY_USER_INFO, "")
|
||||
|
||||
Reference in New Issue
Block a user