From b2d359ba05b508bf10fc96db5b9795f700a602cf Mon Sep 17 00:00:00 2001 From: CaiHQ Date: Mon, 1 Nov 2021 18:52:02 +0800 Subject: [PATCH] feat: support requestID auto append in agent websocket --- .../src/org/bdware/server/action/ReplyUtil.java | 12 ++++++++++-- .../src/org/bdware/server/action/Result.java | 16 ---------------- 2 files changed, 10 insertions(+), 18 deletions(-) delete mode 100644 src/main/src/org/bdware/server/action/Result.java diff --git a/src/main/src/org/bdware/server/action/ReplyUtil.java b/src/main/src/org/bdware/server/action/ReplyUtil.java index 87416b7..d0d4839 100644 --- a/src/main/src/org/bdware/server/action/ReplyUtil.java +++ b/src/main/src/org/bdware/server/action/ReplyUtil.java @@ -6,10 +6,18 @@ import java.util.HashMap; import java.util.Map; public class ReplyUtil { - public static void simpleReply(ResultCallback cb, String action, Object data) { + public static void simpleReply(ResultCallback resultCallback, String action, Object data) { Map ret = new HashMap<>(); ret.put("action", action); ret.put("data", data); - cb.onResult(ret); + resultCallback.onResult(ret); + } + + public static void replyWithStatus(ResultCallback resultCallback, String action, boolean status,Object data) { + Map ret = new HashMap<>(); + ret.put("action", action); + ret.put("status",status); + ret.put("data", data); + resultCallback.onResult(ret); } } \ No newline at end of file diff --git a/src/main/src/org/bdware/server/action/Result.java b/src/main/src/org/bdware/server/action/Result.java deleted file mode 100644 index 42edcd1..0000000 --- a/src/main/src/org/bdware/server/action/Result.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.bdware.server.action; - -public class Result { - boolean status; - String msg; - String action = null; - Object data; - String responseID; - - Result() { - status = false; - msg = null; - data = ""; - responseID=""; - } -} \ No newline at end of file