营养数据计算优化;人脸增加数据处理;其它优化;
This commit is contained in:
@@ -5,6 +5,7 @@ import com.arcsoft.face.ErrorInfo
|
||||
import com.sw.dualscreen.GlobalData
|
||||
import com.sw.dualscreen.GlobalKey
|
||||
import com.sw.dualscreen.model.request.UserNutritionParam
|
||||
import com.sw.dualscreen.model.response.DeviceConfig
|
||||
import com.sw.dualscreen.model.response.DinnerType
|
||||
import com.sw.dualscreen.model.response.FoodInfo
|
||||
import com.sw.dualscreen.model.response.FoodOrder
|
||||
@@ -14,6 +15,7 @@ import com.sw.dualscreen.model.response.UserFaceModel2
|
||||
import com.sw.dualscreen.model.response.UserNutrition
|
||||
import com.sw.dualscreen.objbox.CollectedFoodInfo
|
||||
import com.sw.dualscreen.utils.SPUtil
|
||||
import com.sw.dualscreen.utils.SpTool
|
||||
import com.sw.plate.App
|
||||
import com.sw.plate.utils.Base64
|
||||
import com.sw.plate.utils.ToastUtils
|
||||
@@ -98,6 +100,7 @@ class UserViewModel : BaseViewModel() {
|
||||
ToastUtils.showToast("查询人脸数据为空")
|
||||
return@withContext
|
||||
}
|
||||
SpTool.setLastFaceTimestamp(System.currentTimeMillis())
|
||||
// val item = list.firstOrNull { it.userId == "1951105919342936066" }
|
||||
// Timber.tag(TAG).d("getUserFaceCache userId = ${item?.userId}")
|
||||
val faceEntity = list.map {
|
||||
@@ -146,6 +149,30 @@ class UserViewModel : BaseViewModel() {
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
/**
|
||||
* 获取人脸数据
|
||||
*/
|
||||
fun getFaceIncrementList(
|
||||
pageNo: Int = 1,
|
||||
pageSize: Int = PAGE_SIZE,
|
||||
timestamp: Long,
|
||||
block: (List<UserFaceModel>) -> Unit
|
||||
) {
|
||||
Timber.tag(TAG).d("getFaceIncrementList")
|
||||
launch {
|
||||
val response = repository.getFaceIncrementList(
|
||||
pageNum = pageNo.toLong(),
|
||||
pageSize = pageSize.toLong(),
|
||||
timestamp = timestamp
|
||||
)
|
||||
if (parseResponse(response)) {
|
||||
withContext(Dispatchers.Default) {
|
||||
val list: List<UserFaceModel> = response.data ?: emptyList()
|
||||
block(list)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun getCollectedFoodList(
|
||||
pageNo: Int = 1,
|
||||
@@ -426,7 +453,7 @@ class UserViewModel : BaseViewModel() {
|
||||
fun bindOrder(userId: String, orderId: String, mode: Int, block: (Boolean) -> Unit) {
|
||||
Timber.tag(TAG).d("bindOrder")
|
||||
launchWithLoading {
|
||||
val response = repository.bindOrder(userId = userId, orderId = orderId, mode =mode)
|
||||
val response = repository.bindOrder(userId = userId, orderId = orderId, mode = mode)
|
||||
if (parseResponse(response)) {
|
||||
block(true)
|
||||
} else {
|
||||
@@ -492,4 +519,16 @@ class UserViewModel : BaseViewModel() {
|
||||
// }
|
||||
return resp.code == "00000"
|
||||
}
|
||||
|
||||
fun getDeviceConfig(block: (DeviceConfig?) -> Unit) {
|
||||
Timber.tag(TAG).d("getDeviceConfig")
|
||||
launchWithLoading {
|
||||
val response = repository.getDeviceConfig()
|
||||
if (parseResponse(response)) {
|
||||
block(response.data)
|
||||
} else {
|
||||
block(null)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user