餐盘柜优化-绑定临时用户

This commit is contained in:
mazengfei
2026-01-16 16:14:38 +08:00
parent 8337b3fabb
commit cf2d2db42f
10 changed files with 267 additions and 176 deletions
@@ -33,8 +33,8 @@ class UserViewModel : BaseViewModel() {
}
// 通过人脸获取到的用户信息
private val _currentUserInfo = MutableStateFlow<EquipmentUserInfo?>(null)
val currentUserInfo: StateFlow<EquipmentUserInfo?> = _currentUserInfo
// private val _currentUserInfo = MutableStateFlow<EquipmentUserInfo?>(null)
// val currentUserInfo: StateFlow<EquipmentUserInfo?> = _currentUserInfo
private val faceApi: FaceApi = FaceApi()
@@ -140,35 +140,35 @@ class UserViewModel : BaseViewModel() {
* 校验码登录
*/
fun loginWithPwd(loginParam: LoginParam) {
launchWithLoading {
val response = repository.equipmentBoxLogin(loginParam)
if (parseResponse(response)) {
_currentUserInfo.value = response.data
}
}
// launchWithLoading {
// val response = repository.equipmentBoxLogin(loginParam)
// if (parseResponse(response)) {
// _currentUserInfo.value = response.data
// }
// }
}
/**
* 通过用户id获取用户信息
*/
fun getUserInfoById(memberId: String?, action: (EquipmentUserInfo?) -> Unit = {}) {
_currentUserInfo.value = null
launchWithLoading {
val loginParam = LoginParam(faceId = memberId)
val response = repository.equipmentBoxLogin(loginParam)
if (parseResponse(response)) {
_currentUserInfo.value = response.data
action(response.data)
}
}
}
// fun getUserInfoById(memberId: String?, action: (EquipmentUserInfo?) -> Unit = {}) {
// _currentUserInfo.value = null
// launchWithLoading {
// val loginParam = LoginParam(faceId = memberId)
// val response = repository.equipmentBoxLogin(loginParam)
// if (parseResponse(response)) {
// _currentUserInfo.value = response.data
// action(response.data)
// }
// }
// }
/**
* 重置用户信息
*/
fun resetUserInfo() {
Timber.d("resetUserInfo")
_currentUserInfo.value = null
// _currentUserInfo.value = null
}
fun getDeviceConfig(block: (DeviceConfig?) -> Unit) {