接口调试、增加人脸识别后主副屏支付金额逻辑、其它优化
This commit is contained in:
@@ -1,23 +1,21 @@
|
||||
package com.sw.dualscreen.repository
|
||||
|
||||
import android.content.Context
|
||||
import android.net.Uri
|
||||
import com.sw.dualscreen.GlobalData
|
||||
import com.sw.dualscreen.model.request.UserNutritionParam
|
||||
import com.sw.dualscreen.model.response.ApiResponse
|
||||
import com.sw.dualscreen.model.response.DinnerType
|
||||
import com.sw.dualscreen.model.response.FoodInfo
|
||||
import com.sw.dualscreen.model.response.FoodSearchReq
|
||||
import com.sw.dualscreen.model.response.FoodOrder
|
||||
import com.sw.dualscreen.model.response.MemberInfo
|
||||
import com.sw.dualscreen.model.response.UserFaceModel
|
||||
import com.sw.dualscreen.model.response.UserNutritionData
|
||||
import com.sw.dualscreen.network.api.ApiService
|
||||
import com.sw.dualscreen.objbox.CollectedFoodInfo
|
||||
import com.sw.dualscreen.utils.ImageUtil
|
||||
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||
import okhttp3.MultipartBody
|
||||
import okhttp3.RequestBody
|
||||
import okhttp3.RequestBody.Companion.asRequestBody
|
||||
import okhttp3.RequestBody.Companion.toRequestBody
|
||||
import java.io.File
|
||||
|
||||
/**
|
||||
@@ -74,18 +72,21 @@ class RemoteRepository constructor(
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取人脸数据
|
||||
*/
|
||||
suspend fun getCollectedFoodList(
|
||||
pageNum: Int,
|
||||
pageSize: Int = 50,
|
||||
pageSize: Int = 100,
|
||||
foodName: String,
|
||||
): ApiResponse<List<CollectedFoodInfo>> {
|
||||
return safeApiCall {
|
||||
apiService.getCollectedFoodList(
|
||||
param = mapOf(
|
||||
"pageNum" to pageNum,
|
||||
"pageSize" to pageSize
|
||||
"pageNum" to "$pageNum",
|
||||
"pageSize" to "$pageSize",
|
||||
"foodName" to foodName,
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -141,10 +142,7 @@ class RemoteRepository constructor(
|
||||
* @param restId 从device服务获取的canteenId字段
|
||||
* @param foodName 菜品名称,多个使用逗号拼接
|
||||
*/
|
||||
suspend fun getFoodInfo(
|
||||
restId: String = GlobalData.restId,
|
||||
foodName: String,
|
||||
): ApiResponse<List<FoodInfo>> {
|
||||
suspend fun getFoodInfo(foodName: String): ApiResponse<List<FoodInfo>> {
|
||||
return safeApiCall {
|
||||
// val map = mutableMapOf<String, List<String>>()
|
||||
// map["nameList"] = foodName.split(",")
|
||||
@@ -152,10 +150,31 @@ class RemoteRepository constructor(
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun createOrder(order: FoodOrder): ApiResponse<Any?> {
|
||||
return safeApiCall {
|
||||
apiService.createOrder(order = order)
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun bindOrder(userId: String, orderId: String): ApiResponse<Any?> {
|
||||
return safeApiCall {
|
||||
apiService.bindOrder(userId = userId, orderId = orderId)
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun getMemberInfo(memberId: String): ApiResponse<MemberInfo?> {
|
||||
return safeApiCall {
|
||||
apiService.getMemberInfo(memberId = memberId)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传采集菜品信息
|
||||
*/
|
||||
suspend fun uploadCollectFoodPics(fileList: List<File>, params: HashMap<String, RequestBody>): ApiResponse<String> {
|
||||
suspend fun uploadCollectFoodPics(
|
||||
fileList: List<File>,
|
||||
params: HashMap<String, RequestBody>
|
||||
): ApiResponse<String> {
|
||||
// 准备文件参数
|
||||
val fileParts = mutableListOf<MultipartBody.Part>()
|
||||
fileList.forEachIndexed { index, file ->
|
||||
|
||||
Reference in New Issue
Block a user