From 6b3281faadce271b7d1116172387cb2f48d3f878 Mon Sep 17 00:00:00 2001 From: MTing Date: Thu, 18 Sep 2025 14:26:08 +0800 Subject: [PATCH] test 18 fix --- .../network/OrderVerificationResultHandler.java | 42 ++++++++++++++++++---- 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/ouxuan/oxface/network/OrderVerificationResultHandler.java b/app/src/main/java/com/ouxuan/oxface/network/OrderVerificationResultHandler.java index 0e48b66..5af2cf7 100644 --- a/app/src/main/java/com/ouxuan/oxface/network/OrderVerificationResultHandler.java +++ b/app/src/main/java/com/ouxuan/oxface/network/OrderVerificationResultHandler.java @@ -101,13 +101,43 @@ public class OrderVerificationResultHandler { public void handleVerificationError(int errorCode, String errorMessage, int verificationType) { LogManager.logError(TAG, "处理验证失败结果,类型: " + verificationType + ", 错误码: " + errorCode + ", 错误信息: " + errorMessage); + // 当人脸验证返回302错误码时,需要将message传入到核销结果页并弹窗显示 + if (verificationType == OrderVerificationManager.TYPE_FACE_VERIFICATION && errorCode == 302) { + LogManager.logInfo(TAG, "人脸验证返回302,显示结果页面并传递错误信息"); + + // 创建一个空的订单数据结构,但包含错误信息 + java.util.Map emptyData = new java.util.HashMap<>(); + java.util.Map data = new java.util.HashMap<>(); + data.put("result", new java.util.ArrayList<>()); + emptyData.put("data", data); + + // 将空订单数据转为JSON字符串 + com.google.gson.Gson gson = new com.google.gson.Gson(); + String orderDataJson = gson.toJson(emptyData); + + // 创建跳转到OrderVerificationResultActivity的Intent + android.content.Intent intent = new android.content.Intent(context, OrderVerificationResultActivity.class); + intent.putExtra("verification_type", verificationType); + intent.putExtra("status", "核销失败"); + intent.putExtra("message", errorMessage != null ? errorMessage : "未找到订单信息"); + intent.putExtra("error_code", errorCode); + + LogManager.logInfo(TAG, "准备跳转到验证结果页面,错误码: " + errorCode + ", 错误信息: " + errorMessage); + + if (listener != null) { + listener.navigateToResultPage(intent); + } + + return; + } + // 当人脸验证返回303/504错误码时,不显示任何提示,但需要恢复摄像头预览 if (verificationType == OrderVerificationManager.TYPE_FACE_VERIFICATION && (errorCode == 303 || errorCode == 504)) { LogManager.logInfo(TAG, "人脸验证返回303/504,不显示提示,但需要恢复摄像头预览"); // 发送广播通知OXFaceOnlineActivity恢复摄像头预览 try { - Intent intent = new Intent("com.ouxuan.oxface.ACTION_RESUME_CAMERA"); + android.content.Intent intent = new android.content.Intent("com.ouxuan.oxface.ACTION_RESUME_CAMERA"); context.sendBroadcast(intent); LogManager.logInfo(TAG, "已发送恢复摄像头预览广播"); } catch (Exception e) { @@ -129,7 +159,7 @@ public class OrderVerificationResultHandler { // 发送广播通知OXFaceOnlineActivity恢复摄像头预览 try { - Intent intent = new Intent("com.ouxuan.oxface.ACTION_RESUME_CAMERA"); + android.content.Intent intent = new android.content.Intent("com.ouxuan.oxface.ACTION_RESUME_CAMERA"); context.sendBroadcast(intent); LogManager.logInfo(TAG, "已发送恢复摄像头预览广播"); } catch (Exception e) { @@ -153,13 +183,13 @@ public class OrderVerificationResultHandler { } // 创建一个空的订单数据结构 - Map emptyData = new HashMap<>(); - Map data = new HashMap<>(); - data.put("result", new ArrayList<>()); + java.util.Map emptyData = new java.util.HashMap<>(); + java.util.Map data = new java.util.HashMap<>(); + data.put("result", new java.util.ArrayList<>()); emptyData.put("data", data); // 将空订单数据转为JSON字符串 - Gson gson = new Gson(); + com.google.gson.Gson gson = new com.google.gson.Gson(); String orderDataJson = gson.toJson(emptyData); LogManager.logInfo(TAG, "暂无可核销订单,准备跳转到订单验证页面");