扫码支付增加会员id字段
This commit is contained in:
@@ -242,7 +242,7 @@ class PayActivity : BaseActivity<ActivityPayBinding>() {
|
||||
}
|
||||
}
|
||||
|
||||
fun memberPay(param: HashMap<String, String>, block: () -> Unit) {
|
||||
fun memberPay(param: HashMap<String, String?>, block: () -> Unit) {
|
||||
userViewModel.memberPay(param) {
|
||||
runOnUiThread {
|
||||
if (it.not()) {
|
||||
@@ -298,7 +298,7 @@ class PayActivity : BaseActivity<ActivityPayBinding>() {
|
||||
|
||||
fun qrCodePay(scanInfo: String) {
|
||||
showWaitingDialog("支付中……")
|
||||
userViewModel.qrCodePay(scanInfo, foodOrderId) { payState, backData ->
|
||||
userViewModel.qrCodePay(scanInfo, foodOrderId, memberInfo?.id) { payState, backData ->
|
||||
Timber.d("qrCodePay支付返回数据:state=$payState,backData=$backData")
|
||||
hideWaitingDialog()
|
||||
if (payState) {
|
||||
|
||||
@@ -289,7 +289,7 @@ class PayResultFragment : BaseFragment<FragmentPayResultBinding>() {
|
||||
//订单号
|
||||
"orderNo" to payActivity.foodOrderId,
|
||||
//用户id
|
||||
"memberId" to memberInfo!!.id!!
|
||||
"memberId" to memberInfo?.id
|
||||
),
|
||||
block = callback
|
||||
)
|
||||
|
||||
@@ -202,7 +202,7 @@ interface ApiService {
|
||||
@POST
|
||||
suspend fun memberPay(
|
||||
@Url url: String = "${GlobalData.appBaseUrl}/terminal/neglect/pay/app/memberPay",
|
||||
@Body param: HashMap<String, String>
|
||||
@Body param: HashMap<String, String?>
|
||||
): ApiResponse<Any?>
|
||||
|
||||
/**
|
||||
@@ -223,7 +223,7 @@ interface ApiService {
|
||||
@POST
|
||||
suspend fun qrCodePay(
|
||||
@Url url: String = "${GlobalData.appBaseUrl}/terminal/neglect/pay/app/qrCodePay",
|
||||
@Body param: HashMap<String, String>
|
||||
@Body param: HashMap<String, String?>
|
||||
): ApiResponse<String?>
|
||||
|
||||
/**
|
||||
|
||||
@@ -76,7 +76,8 @@ class RemoteRepository constructor(
|
||||
)
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
||||
/**
|
||||
* 获取人脸数据
|
||||
*/
|
||||
suspend fun getFaceIncrementList(
|
||||
@@ -134,16 +135,18 @@ class RemoteRepository constructor(
|
||||
suspend fun getRestInfoFoodsByType(
|
||||
foodName: String,
|
||||
pageNum: Int = 1,
|
||||
pageSize:Int = 50
|
||||
pageSize: Int = 50
|
||||
): ApiResponse<List<FoodInfo>> {
|
||||
return safeApiCall {
|
||||
apiService.getRestInfoFoodsByType(param = hashMapOf(
|
||||
"name" to foodName,
|
||||
"pageNum" to "$pageNum",
|
||||
"pageSize" to "$pageSize",
|
||||
//"订单来源权举:1-营养秤,2-档口
|
||||
"deviceType" to "2"
|
||||
))
|
||||
apiService.getRestInfoFoodsByType(
|
||||
param = hashMapOf(
|
||||
"name" to foodName,
|
||||
"pageNum" to "$pageNum",
|
||||
"pageSize" to "$pageSize",
|
||||
//"订单来源权举:1-营养秤,2-档口
|
||||
"deviceType" to "2"
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,12 +192,17 @@ class RemoteRepository constructor(
|
||||
/**
|
||||
* 二维码支付
|
||||
*/
|
||||
suspend fun qrCodePay(authCode: String,orderNo: String): ApiResponse<String?> {
|
||||
suspend fun qrCodePay(
|
||||
authCode: String,
|
||||
orderNo: String,
|
||||
memberId: String?
|
||||
): ApiResponse<String?> {
|
||||
return safeApiCall {
|
||||
apiService.qrCodePay(
|
||||
param = hashMapOf(
|
||||
"authCode" to authCode,
|
||||
"outTradeNo" to orderNo,
|
||||
"memberId" to memberId,
|
||||
"orderType" to "0"
|
||||
)
|
||||
)
|
||||
@@ -262,7 +270,7 @@ class RemoteRepository constructor(
|
||||
/**
|
||||
* 会员支付
|
||||
*/
|
||||
suspend fun memberPay(param: HashMap<String, String>): ApiResponse<Any?> {
|
||||
suspend fun memberPay(param: HashMap<String, String?>): ApiResponse<Any?> {
|
||||
return safeApiCall {
|
||||
apiService.memberPay(param = param)
|
||||
}
|
||||
@@ -291,10 +299,12 @@ class RemoteRepository constructor(
|
||||
*/
|
||||
suspend fun getMemberInfoByPhone(phone: String, key: String): ApiResponse<MemberInfo?> {
|
||||
return safeApiCall {
|
||||
apiService.getMemberInfoByPhone(param = hashMapOf(
|
||||
"phone" to phone,
|
||||
"password" to key
|
||||
))
|
||||
apiService.getMemberInfoByPhone(
|
||||
param = hashMapOf(
|
||||
"phone" to phone,
|
||||
"password" to key
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -332,12 +342,14 @@ class RemoteRepository constructor(
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun deleteCollectFood(foodId:String?, version: String?): ApiResponse<Any?> {
|
||||
suspend fun deleteCollectFood(foodId: String?, version: String?): ApiResponse<Any?> {
|
||||
return safeApiCall {
|
||||
apiService.deleteCollectFood(param = mutableMapOf(
|
||||
"foodId" to foodId,
|
||||
"version" to version
|
||||
))
|
||||
apiService.deleteCollectFood(
|
||||
param = mutableMapOf(
|
||||
"foodId" to foodId,
|
||||
"version" to version
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -110,7 +110,7 @@ class UserViewModel : BaseViewModel() {
|
||||
//val item = list.map { it.member }
|
||||
//Timber.tag(TAG).d("getUserFaceCache item = $item")
|
||||
val faceEntity = list.map {
|
||||
FaceEntity(it.userId, null, Base64.decode(it.faceFeatureStr)).also { item->
|
||||
FaceEntity(it.userId, null, Base64.decode(it.faceFeatureStr)).also { item ->
|
||||
item.userType = if (it.member) "1" else "2"
|
||||
item.cardNo = it.cardNo
|
||||
}
|
||||
@@ -363,9 +363,14 @@ class UserViewModel : BaseViewModel() {
|
||||
/**
|
||||
* 二维码支付
|
||||
*/
|
||||
fun qrCodePay(authCode: String,orderNo: String, block:(Boolean, String?)-> Unit){
|
||||
fun qrCodePay(
|
||||
authCode: String,
|
||||
orderNo: String,
|
||||
memberId: String?,
|
||||
block: (Boolean, String?) -> Unit
|
||||
) {
|
||||
launch {
|
||||
val response = repository.qrCodePay(authCode, orderNo)
|
||||
val response = repository.qrCodePay(authCode, orderNo, memberId)
|
||||
if (parseResponse(response)) {
|
||||
block(true, response.data)
|
||||
} else {
|
||||
@@ -373,6 +378,7 @@ class UserViewModel : BaseViewModel() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun getDinnerType() {
|
||||
Timber.tag(TAG).d("getDinnerType")
|
||||
_dinnerTypeInfo.value = null
|
||||
@@ -491,7 +497,7 @@ class UserViewModel : BaseViewModel() {
|
||||
/**
|
||||
* 会员支付
|
||||
*/
|
||||
fun memberPay(param: HashMap<String, String>, block: (Boolean) -> Unit) {
|
||||
fun memberPay(param: HashMap<String, String?>, block: (Boolean) -> Unit) {
|
||||
Timber.tag(TAG).d("memberPay")
|
||||
launchWithLoading {
|
||||
val response = repository.memberPay(param)
|
||||
@@ -588,19 +594,22 @@ class UserViewModel : BaseViewModel() {
|
||||
}
|
||||
}
|
||||
|
||||
fun getCollectedFoodVector(param: MutableMap<String, String>, block: (List<FoodVector>?) -> Unit) {
|
||||
fun getCollectedFoodVector(
|
||||
param: MutableMap<String, String>,
|
||||
block: (List<FoodVector>?) -> Unit
|
||||
) {
|
||||
Timber.tag(TAG).d("getCollectedFoodVector")
|
||||
launchWithLoading {
|
||||
val response = repository.getCollectedFoodVector(param)
|
||||
if (parseResponse(response)) {
|
||||
block(response.data?:emptyList())
|
||||
block(response.data ?: emptyList())
|
||||
} else {
|
||||
block(null)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun deleteCollectFood(foodId:String?, version: String?, block: (Boolean) -> Unit) {
|
||||
fun deleteCollectFood(foodId: String?, version: String?, block: (Boolean) -> Unit) {
|
||||
Timber.tag(TAG).d("deleteCollectFood")
|
||||
launchWithLoading {
|
||||
val response = repository.deleteCollectFood(foodId, version)
|
||||
|
||||
Reference in New Issue
Block a user