front: support startMulitipoint with args

fix: ContractClient missing arguments error
update: @Router arguments format
fix: ContractStatusRecorder null exception
This commit is contained in:
CaiHQ 2022-06-26 17:54:29 +08:00
parent b468f5947f
commit bfd389f30e

View File

@ -128,29 +128,16 @@ public class MultiPointCooperationExecutor extends AbstractContextContractExecut
return new String[]{members[val]};
case byFunc:
ContractClient client = cmActions.getManager().getClient(req.getContractID());
JsonArray membersArr = new JsonArray(members.length);
for (String member : members) {
membersArr.add(member);
}
JsonObject arg = new JsonObject();
arg.addProperty("funcName", routeInfo.funcName);
// func myFunc (currentNode, members, membersCount, sourceArg)
// func myFunc (requester, sourceArg)
JsonArray funcArgs = new JsonArray();
funcArgs.add(globalConf.getNodeID());
funcArgs.add(membersArr);
funcArgs.add(membersArr.size());
funcArgs.add(req.getRequester());
funcArgs.add(req.getArg());
arg.add("funcArgs", funcArgs);
String routeResultStr = client.executeMethod("", "invokeFunctionWithoutLimit", arg.toString());
JsonObject routeResult = JsonUtil.parseString(routeResultStr).getAsJsonObject();
List<String> nodes = new ArrayList<>();
for (String key: routeResult.keySet()) {
nodes.add(routeResult.get(key).getAsString());
}
return nodes.toArray(new String[]{});
String[] routeResult = JsonUtil.fromJson(routeResultStr, String[].class);
return routeResult;
default:
return members;
}