绑定解绑功能调试;其它优化

This commit is contained in:
马增飞
2026-01-05 18:38:10 +08:00
parent 17d47a876f
commit 582be4e9b7
16 changed files with 170 additions and 108 deletions
@@ -66,26 +66,32 @@ class UserViewModel : BaseViewModel() {
// 获取成功一次后缓存状态
SPUtil.getInstance().put(GlobalKey.KEY_FIRST_RUN, true)
val list: List<UserFaceModel> = response.data ?: emptyList()
if (list.isEmpty()) {
if (pageNo==1&&list.isEmpty()) {
return@launchWithLoading
}
SpTool.setLastFaceTimestamp(System.currentTimeMillis())
val faceEntityList = list.map {
FaceEntity(it.userId, null, Base64.decode(it.faceFeatureStr))
}
withContext(Dispatchers.Default) {
faceApi.updateFaceData(pageNo, faceEntityList)
if (list.size >= pageSize) {
faceTimestamp = list.last().faceUpdateTimestamp?:0
currentPageNo++
getUserFaceCache(currentPageNo)
return@withContext
}
if (list.isNotEmpty()) {
faceTimestamp = list.last().faceUpdateTimestamp?:0
}
SpTool.setLastFaceTimestamp(faceTimestamp)
//activeEngine()
}
}
}
}
private var faceTimestamp = 0L
/**
* 激活人脸识别引擎
*/
@@ -144,7 +150,7 @@ class UserViewModel : BaseViewModel() {
fun getUserInfoById(memberId: String?, action:(EquipmentUserInfo?)->Unit={}) {
_currentUserInfo.value = null
launchWithLoading {
val loginParam = LoginParam(memberId = memberId)
val loginParam = LoginParam(faceId = memberId)
val response = repository.equipmentBoxLogin(loginParam)
if (parseResponse(response)) {
_currentUserInfo.value = response.data