Browse Source

test 18 fix

devab
MTing 4 weeks ago
parent
commit
6b3281faad
  1. 42
      app/src/main/java/com/ouxuan/oxface/network/OrderVerificationResultHandler.java

42
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) { public void handleVerificationError(int errorCode, String errorMessage, int verificationType) {
LogManager.logError(TAG, "处理验证失败结果,类型: " + verificationType + ", 错误码: " + errorCode + ", 错误信息: " + errorMessage); LogManager.logError(TAG, "处理验证失败结果,类型: " + verificationType + ", 错误码: " + errorCode + ", 错误信息: " + errorMessage);
// 当人脸验证返回302错误码时需要将message传入到核销结果页并弹窗显示
if (verificationType == OrderVerificationManager.TYPE_FACE_VERIFICATION && errorCode == 302) {
LogManager.logInfo(TAG, "人脸验证返回302,显示结果页面并传递错误信息");
// 创建一个空的订单数据结构但包含错误信息
java.util.Map<String, Object> emptyData = new java.util.HashMap<>();
java.util.Map<String, Object> 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错误码时不显示任何提示但需要恢复摄像头预览 // 当人脸验证返回303/504错误码时不显示任何提示但需要恢复摄像头预览
if (verificationType == OrderVerificationManager.TYPE_FACE_VERIFICATION && (errorCode == 303 || errorCode == 504)) { if (verificationType == OrderVerificationManager.TYPE_FACE_VERIFICATION && (errorCode == 303 || errorCode == 504)) {
LogManager.logInfo(TAG, "人脸验证返回303/504,不显示提示,但需要恢复摄像头预览"); LogManager.logInfo(TAG, "人脸验证返回303/504,不显示提示,但需要恢复摄像头预览");
// 发送广播通知OXFaceOnlineActivity恢复摄像头预览 // 发送广播通知OXFaceOnlineActivity恢复摄像头预览
try { 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); context.sendBroadcast(intent);
LogManager.logInfo(TAG, "已发送恢复摄像头预览广播"); LogManager.logInfo(TAG, "已发送恢复摄像头预览广播");
} catch (Exception e) { } catch (Exception e) {
@ -129,7 +159,7 @@ public class OrderVerificationResultHandler {
// 发送广播通知OXFaceOnlineActivity恢复摄像头预览 // 发送广播通知OXFaceOnlineActivity恢复摄像头预览
try { 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); context.sendBroadcast(intent);
LogManager.logInfo(TAG, "已发送恢复摄像头预览广播"); LogManager.logInfo(TAG, "已发送恢复摄像头预览广播");
} catch (Exception e) { } catch (Exception e) {
@ -153,13 +183,13 @@ public class OrderVerificationResultHandler {
} }
// 创建一个空的订单数据结构 // 创建一个空的订单数据结构
Map<String, Object> emptyData = new HashMap<>();
Map<String, Object> data = new HashMap<>();
data.put("result", new ArrayList<>());
java.util.Map<String, Object> emptyData = new java.util.HashMap<>();
java.util.Map<String, Object> data = new java.util.HashMap<>();
data.put("result", new java.util.ArrayList<>());
emptyData.put("data", data); emptyData.put("data", data);
// 将空订单数据转为JSON字符串 // 将空订单数据转为JSON字符串
Gson gson = new Gson();
com.google.gson.Gson gson = new com.google.gson.Gson();
String orderDataJson = gson.toJson(emptyData); String orderDataJson = gson.toJson(emptyData);
LogManager.logInfo(TAG, "暂无可核销订单,准备跳转到订单验证页面"); LogManager.logInfo(TAG, "暂无可核销订单,准备跳转到订单验证页面");

Loading…
Cancel
Save