t调试
This commit is contained in:
@@ -175,7 +175,7 @@ class PayResultFragment : BaseFragment<FragmentPayResultBinding>() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun loadUserInfo(item: MemberInfo) {
|
private fun loadUserInfo(item: MemberInfo) {
|
||||||
binding.ivHeadPic.load(R.mipmap.ic_launcher)
|
binding.ivHeadPic.load(item.faceUrl?.ifBlank { R.drawable.ic_avatar_default })
|
||||||
binding.tvUserName.text = item.name
|
binding.tvUserName.text = item.name
|
||||||
|
|
||||||
val phone = item.phone ?: ""
|
val phone = item.phone ?: ""
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ data class MemberInfo(
|
|||||||
val phone: String?,
|
val phone: String?,
|
||||||
//姓名
|
//姓名
|
||||||
val name: String?,
|
val name: String?,
|
||||||
|
//头像
|
||||||
|
val faceUrl: String?,
|
||||||
//充值余额
|
//充值余额
|
||||||
val topUpBalance: Double?,
|
val topUpBalance: Double?,
|
||||||
//赠送余额
|
//赠送余额
|
||||||
@@ -92,7 +94,7 @@ data class UserNutrition(
|
|||||||
//肉蛋超量
|
//肉蛋超量
|
||||||
val meatEggsExcess: String?=null,
|
val meatEggsExcess: String?=null,
|
||||||
)
|
)
|
||||||
|
//{"code":"00000","data":"{\"orderType\":0,\"orderPayFrom\":2,\"payType\":\"1\",\"paySuc\":0,\"totalFee\":0.01,\"orderCode\":\"1998193614899372032\",\"message\":\"支付成功\",\"payCode\":\"1998193614899372032508227\"}","msg":"成功","total":0}
|
||||||
data class PayResult(
|
data class PayResult(
|
||||||
val paySuc: String? = null
|
val paySuc: String? = null
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -41,12 +41,13 @@ data class FoodInfo(
|
|||||||
val meatEggs:Double? = null,
|
val meatEggs:Double? = null,
|
||||||
//推荐能量
|
//推荐能量
|
||||||
val recommendCalorie: Double? = null,
|
val recommendCalorie: Double? = null,
|
||||||
|
//图片
|
||||||
|
var foodImg: String? = "",
|
||||||
|
|
||||||
//-----------------------------------
|
//-----------------------------------
|
||||||
var score: Int = 0,
|
var score: Int = 0,
|
||||||
var isChecked: Boolean = false,
|
var isChecked: Boolean = false,
|
||||||
var photoUri: Uri? = null,
|
var photoUri: Uri? = null,
|
||||||
var foodImg: String? = "",
|
|
||||||
|
|
||||||
// @SerializedName("foodTypeAndRealIntakeVoList")
|
// @SerializedName("foodTypeAndRealIntakeVoList")
|
||||||
// val foodTypeAndRealIntakeVoList: List<FoodTypeAndRealIntakeVo>? = listOf(),
|
// val foodTypeAndRealIntakeVoList: List<FoodTypeAndRealIntakeVo>? = listOf(),
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ class ScanQrCodePayPresentation(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun loadUserInfo(item: MemberInfo) {
|
private fun loadUserInfo(item: MemberInfo) {
|
||||||
binding.ivHeadPic.load(R.mipmap.ic_launcher)
|
binding.ivHeadPic.load(item.faceUrl?.ifBlank { R.drawable.ic_avatar_default })
|
||||||
binding.tvUserName.text = item.name
|
binding.tvUserName.text = item.name
|
||||||
|
|
||||||
val phone = item.phone ?: ""
|
val phone = item.phone ?: ""
|
||||||
|
|||||||
@@ -98,8 +98,12 @@ class UserViewModel : BaseViewModel() {
|
|||||||
SPUtil.getInstance().put(GlobalKey.KEY_FIRST_RUN, true)
|
SPUtil.getInstance().put(GlobalKey.KEY_FIRST_RUN, true)
|
||||||
withContext(Dispatchers.Default) {
|
withContext(Dispatchers.Default) {
|
||||||
val list: List<UserFaceModel> = response.data ?: emptyList()
|
val list: List<UserFaceModel> = response.data ?: emptyList()
|
||||||
val item = list.firstOrNull { it.userId == "1951105919342936066" }
|
if (list.isEmpty()) {
|
||||||
Timber.tag(TAG).d("getUserFaceCache userId = ${item?.userId}")
|
ToastUtils.showToast("查询人脸数据为空")
|
||||||
|
return@withContext
|
||||||
|
}
|
||||||
|
// val item = list.firstOrNull { it.userId == "1951105919342936066" }
|
||||||
|
// Timber.tag(TAG).d("getUserFaceCache userId = ${item?.userId}")
|
||||||
val faceEntity = list.map {
|
val faceEntity = list.map {
|
||||||
FaceEntity(it.userId, null, Base64.decode(it.faceFeatureStr))
|
FaceEntity(it.userId, null, Base64.decode(it.faceFeatureStr))
|
||||||
}
|
}
|
||||||
@@ -384,7 +388,14 @@ class UserViewModel : BaseViewModel() {
|
|||||||
Timber.tag(TAG).d("queryOrderState")
|
Timber.tag(TAG).d("queryOrderState")
|
||||||
val response = repository.queryOrderState(orderNo = orderId)
|
val response = repository.queryOrderState(orderNo = orderId)
|
||||||
if (parseResponse(response)) {
|
if (parseResponse(response)) {
|
||||||
val orderState = response.data == "1"
|
val respData = response.data as? String
|
||||||
|
?: if (response.data is Any) {
|
||||||
|
GsonUtils.toJson(response.data)
|
||||||
|
} else {
|
||||||
|
""
|
||||||
|
}
|
||||||
|
val payResult = GsonUtils.fromJson(respData, PayResult::class.java)
|
||||||
|
val orderState = payResult?.paySuc == "1"
|
||||||
block(orderState)
|
block(orderState)
|
||||||
} else {
|
} else {
|
||||||
block(false)
|
block(false)
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
@@ -27,7 +27,7 @@
|
|||||||
android:id="@+id/ivHeadPic"
|
android:id="@+id/ivHeadPic"
|
||||||
android:layout_width="120dp"
|
android:layout_width="120dp"
|
||||||
android:layout_height="120dp"
|
android:layout_height="120dp"
|
||||||
android:src="@mipmap/ic_launcher"
|
android:src="@drawable/ic_avatar_default"
|
||||||
app:shapeAppearance="@style/CircleStyle"
|
app:shapeAppearance="@style/CircleStyle"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|||||||
@@ -121,7 +121,7 @@
|
|||||||
android:id="@+id/ivHeadPic"
|
android:id="@+id/ivHeadPic"
|
||||||
android:layout_width="84dp"
|
android:layout_width="84dp"
|
||||||
android:layout_height="84dp"
|
android:layout_height="84dp"
|
||||||
tools:src="@mipmap/ic_launcher"
|
android:src="@drawable/ic_avatar_default"
|
||||||
android:layout_marginTop="28dp"
|
android:layout_marginTop="28dp"
|
||||||
app:shapeAppearance="@style/CircleStyle"
|
app:shapeAppearance="@style/CircleStyle"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package com.sw.plate.utils;
|
|||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -30,18 +32,23 @@ public class ToastUtils {
|
|||||||
* @param text the text
|
* @param text the text
|
||||||
*/
|
*/
|
||||||
public static void showToast(String text) {
|
public static void showToast(String text) {
|
||||||
Context context = App.getContext();
|
runOnMainThread(()->{
|
||||||
if (toast == null) {
|
Context context = App.getContext();
|
||||||
View view = LayoutInflater.from(context).inflate(R.layout.toast_bg, null);
|
if (toast == null) {
|
||||||
textCenterView = view.findViewById(R.id.toast_tv);
|
View view = LayoutInflater.from(context).inflate(R.layout.toast_bg, null);
|
||||||
toast = new Toast(context);
|
textCenterView = view.findViewById(R.id.toast_tv);
|
||||||
toast.setGravity(Gravity.CENTER, 0, 20);
|
toast = new Toast(context);
|
||||||
toast.setDuration(Toast.LENGTH_SHORT);
|
toast.setGravity(Gravity.CENTER, 0, 20);
|
||||||
toast.setView(view);
|
toast.setDuration(Toast.LENGTH_SHORT);
|
||||||
}
|
toast.setView(view);
|
||||||
|
}
|
||||||
|
textCenterView.setText(text);
|
||||||
|
toast.show();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
textCenterView.setText(text);
|
public static void runOnMainThread(Runnable runnable) {
|
||||||
toast.show();
|
new Handler(Looper.getMainLooper()).post(runnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -50,32 +57,36 @@ public class ToastUtils {
|
|||||||
* @param text the text
|
* @param text the text
|
||||||
*/
|
*/
|
||||||
public static void showToast(String text, int duration) {
|
public static void showToast(String text, int duration) {
|
||||||
Context context = App.getContext();
|
runOnMainThread(()-> {
|
||||||
if (toast == null) {
|
Context context = App.getContext();
|
||||||
View view = LayoutInflater.from(context).inflate(R.layout.toast_bg, null);
|
if (toast == null) {
|
||||||
textCenterView = view.findViewById(R.id.toast_tv);
|
View view = LayoutInflater.from(context).inflate(R.layout.toast_bg, null);
|
||||||
toast = new Toast(context);
|
textCenterView = view.findViewById(R.id.toast_tv);
|
||||||
toast.setGravity(Gravity.CENTER, 0, 20);
|
toast = new Toast(context);
|
||||||
toast.setView(view);
|
toast.setGravity(Gravity.CENTER, 0, 20);
|
||||||
}
|
toast.setView(view);
|
||||||
|
}
|
||||||
|
|
||||||
textCenterView.setText(text);
|
textCenterView.setText(text);
|
||||||
toast.setDuration(duration);
|
toast.setDuration(duration);
|
||||||
toast.show();
|
toast.show();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showLongToast(String text) {
|
public static void showLongToast(String text) {
|
||||||
Context context = App.getContext();
|
runOnMainThread(()-> {
|
||||||
if (toast == null) {
|
Context context = App.getContext();
|
||||||
View view = LayoutInflater.from(context).inflate(R.layout.toast_bg, null);
|
if (toast == null) {
|
||||||
textCenterView = view.findViewById(R.id.toast_tv);
|
View view = LayoutInflater.from(context).inflate(R.layout.toast_bg, null);
|
||||||
toast = new Toast(context);
|
textCenterView = view.findViewById(R.id.toast_tv);
|
||||||
toast.setGravity(Gravity.TOP, 0, 20);
|
toast = new Toast(context);
|
||||||
toast.setDuration(Toast.LENGTH_LONG);
|
toast.setGravity(Gravity.TOP, 0, 20);
|
||||||
toast.setView(view);
|
toast.setDuration(Toast.LENGTH_LONG);
|
||||||
}
|
toast.setView(view);
|
||||||
textCenterView.setText(text);
|
}
|
||||||
showMyToast(toast, 1000000 * 30);
|
textCenterView.setText(text);
|
||||||
|
showMyToast(toast, 1000000 * 30);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user