添加菜品采集

This commit is contained in:
mazengfei
2025-10-31 09:53:51 +08:00
parent ed6c5e83be
commit e47b362883
16 changed files with 426 additions and 68 deletions
@@ -1,5 +1,7 @@
package com.sw.dualscreen.viewmodel
import android.content.Context
import android.net.Uri
import androidx.lifecycle.viewModelScope
import com.arcsoft.face.ErrorInfo
import com.sw.dualscreen.GlobalData
@@ -48,7 +50,7 @@ class UserViewModel : BaseViewModel() {
* 人脸加载完成
*/
private val _loadFaceResult = MutableStateFlow<Boolean>(false)
val loadFaceResult : StateFlow<Boolean> = _loadFaceResult
val loadFaceResult: StateFlow<Boolean> = _loadFaceResult
private val _identifiedFoodInfoList2 = MutableStateFlow<List<FoodInfo>>(emptyList())
val identifiedFoodInfoList2: StateFlow<List<FoodInfo>> = _identifiedFoodInfoList2
@@ -91,7 +93,7 @@ class UserViewModel : BaseViewModel() {
val nextPageIndex = response.result?.nextPageIndex ?: -1
if (nextPageIndex > 0) {
getUserFaceCache(nextPageIndex)
} else{
} else {
_loadFaceResult.value = true
}
}
@@ -217,4 +219,23 @@ class UserViewModel : BaseViewModel() {
}
}
}
fun postImageData(
context: Context,
foodId: String,
foodName: String,
foodVector: String,
uri: Uri
) {
Timber.d("postImageData")
launchWithLoading {
val response = repository.postImageData(
context, foodId = foodId, foodName = foodName, foodVector = foodVector,
uri = uri
)
if (parseResponse(response)) {
Timber.tag("mzf").d("code=${response.code}")
}
}
}
}