From 8797e0c309359e1d22543274c81703e88b4ccad9 Mon Sep 17 00:00:00 2001 From: CaiHQ Date: Tue, 24 Oct 2023 18:07:14 +0800 Subject: [PATCH] patch --- backend/build.gradle | 2 +- backend/debugconf.json | 2 +- backend/deployconfig.json | 4 +- .../sc/controlproxy/TopologyCollector.java | 1 - backend/todo.md | 15 ++- backend/yjs/ControlProxy.yjs | 99 ++++++++++--------- backend/yjs/networking.yjs | 26 ++--- backend/yjs/repodetail.yjs | 4 +- backend/yjs/search.yjs | 49 +++++---- 9 files changed, 111 insertions(+), 91 deletions(-) diff --git a/backend/build.gradle b/backend/build.gradle index 1aaeea3..9edffb3 100644 --- a/backend/build.gradle +++ b/backend/build.gradle @@ -14,7 +14,7 @@ plugins { id 'java' id 'java-library' } -version = "1.4.0" +version = "1.4.1" group = 'org.bdware.sc.controlproxy' tasks.withType(JavaCompile) { diff --git a/backend/debugconf.json b/backend/debugconf.json index 00500f4..7e89670 100644 --- a/backend/debugconf.json +++ b/backend/debugconf.json @@ -9,7 +9,7 @@ "auditType": "OnlyHash" }, "killBeforeStart": "ControlProxy", - "ypkPath": "/Users/huaqiancai/BDWare/ControlProxy/backend/build/ControlProxy-1.3.9.ypk", + "ypkPath": "/Users/huaqiancai/BDWare/ControlProxy/backend/build/ControlProxy-1.4.0.ypk", "publicKey": "04d1924329f72ced148f6f333fb985ccbaa31b1e3aacf10be5f43d4a4ff5ad88899a005e79e37fc06993e1d66ada8cf8b711cb36f59538bb7d3e39e70fa9360ddd", "privateKey": "589d94ee5688358a1c5c18430dd9c75097ddddebf769f139da36a807911d20f8" } \ No newline at end of file diff --git a/backend/deployconfig.json b/backend/deployconfig.json index a1a80e6..4ac8bbc 100644 --- a/backend/deployconfig.json +++ b/backend/deployconfig.json @@ -10,6 +10,8 @@ "prefix": "shanxi", "router": "GlobalRouter", "routerURI": "tcp://39.104.209.178:18041", - "auditType": "OnlyHash" + "auditType": "OnlyHash", + "reqPublicKey": "04303718771b9323c204e607639f14469f9a94e55b0964a408ad3b3864b0493b645d7070da0d550f0c54b934275a8e88dedc3024467b0566db5c1108b1baeaae27", + "reqPrivateKey": "d675782acf011dbc01a73c7967ccff9564486f7c3a9f5d5de151caffaa18936" } } \ No newline at end of file diff --git a/backend/src/main/java/org/bdware/sc/controlproxy/TopologyCollector.java b/backend/src/main/java/org/bdware/sc/controlproxy/TopologyCollector.java index 40eaf8e..2b97847 100644 --- a/backend/src/main/java/org/bdware/sc/controlproxy/TopologyCollector.java +++ b/backend/src/main/java/org/bdware/sc/controlproxy/TopologyCollector.java @@ -163,7 +163,6 @@ public class TopologyCollector { graph.addGraph(points); if (arg > 0) { ContractResult nextRouters = executeContract(RepoProxy.router, "listLRS", new JsonPrimitive("a")); - JsonArray routersArray = nextRouters.result.getAsJsonObject().get("data").getAsJsonArray(); for (JsonElement je : routersArray) { if (!je.getAsJsonObject().get("doId").getAsString().startsWith(points.get(0).get("doId").getAsString())) { diff --git a/backend/todo.md b/backend/todo.md index 73f999d..94c9a01 100644 --- a/backend/todo.md +++ b/backend/todo.md @@ -1,2 +1,15 @@ 1. TopologyCollector中的缓存逻辑优化,要按不同的level来改 -2. \ No newline at end of file +# 20230920 + +接口: getRepoList +问题: 缺少,所有者,说明, 审核状态字段 +接口: pingRepo +问题: 缺少“名称”,“所有者” 字段 +接口: deleteRepoList +问题:msg: "can not found repo", code: 1 +接口: getDoList +问题: 返回数据不对只返回了一个success + + +接口: "queryByHash" +问题: Contract AutoAuditcan't be located in router diff --git a/backend/yjs/ControlProxy.yjs b/backend/yjs/ControlProxy.yjs index 7fde766..335211f 100755 --- a/backend/yjs/ControlProxy.yjs +++ b/backend/yjs/ControlProxy.yjs @@ -10,27 +10,29 @@ import "union.yjs"; //本文接口由李智负责对接。 contract ControlProxy { function convertArgToJson(arg) { - if (typeof(arg)=='string' && !arg.startsWith("{")) return arg; - if (typeof(arg)=='string') return JSON.parse(arg); + if (typeof(arg) == 'string' && ! arg.startsWith("{") && !arg.startsWith("[")) return arg; + if (typeof(arg) == 'string') return JSON.parse(arg); return arg; } function onCreate(arg) { - if (arg==null|| typeof(arg)=='string'){ + if (arg == null || typeof(arg) == 'string'){ arg = { - "prefix":"test.ab.cd", "router":"GlobalRouter" + "prefix" : "test.ab.cd", "router" : "GlobalRouter" }; } arg = convertArgToJson(arg); Global.router = "GlobalRouter"; Global.prefix = arg.prefix; Global.router = arg.router; + if (arg.reqPublicKey != undefined) + YancloudUtil.setSM2KeyPair(arg.reqPublicKey, arg.reqPrivateKey); initDAC(requester); org.bdware.sc.controlproxy.RepoProxy.init(arg); } function isString(arg) { - return typeof(arg)=='string'; + return typeof(arg) == 'string'; } export function getControlProxyConfig() { @@ -43,25 +45,26 @@ contract ControlProxy { @Description("参数为,{\"doId\":\"bdware.ss/Repox\"}") export function addRepo(arg) { arg = convertArgToJson(arg); - if (arg.doId ==undefined ){ + if (arg.doId == undefined ){ return { - "msg":"missing arguments repoId ", "code":1 + "msg" : "missing arguments repoId ", "code" : 1 }; } executeContract("Gateway", "addLocalRepo", arg); return { - "msg":"success", "rrt":"110ms", "code":0 + "msg" : "success", "rrt" : "110ms", "code" : 0 }; } //网关需新增的接口 @Description("参数为,{\"doId\":\"bdware.ss/Repox\"}") export function pingRepo(arg) { - arg = convertArgToJson(arg); - if (arg.doId ==undefined ){ - return { - "msg":"missing arguments repoId ", "code":1 - }; - } + return executeContract("ShanxiControlProxy", "pingRepo", arg).result; +// arg = convertArgToJson(arg); +// if (arg.doId == undefined ){ +// return { +// "msg" : "missing arguments repoId ", "code" : 1 +// }; +// } // var ret = executeContract("Gateway", "pingRepo", arg.doId); // ret = ret.result; // if (ret.rrt > 0) @@ -70,7 +73,7 @@ contract ControlProxy { // }; else return { // "msg":"repo is unconnected", "code":1 // }; - return org.bdware.sc.controlproxy.RepoProxy.pingRepo(arg.doId); + // return org.bdware.sc.controlproxy.RepoProxy.pingRepo(arg.doId); } @Description("shanxi/TestLocal shanxi/Repository") @@ -89,66 +92,74 @@ contract ControlProxy { ret = executeContract(Global.router, "listRepo", ""); //ret=executeContract("Gateway","listLocalRepo",""); //var list = ret.result + for (var i=0;i1){ var ret = { }; ret.result = { @@ -54,8 +54,6 @@ module RepoDetail { ret.result.total = data.length; return ret; } - - return "success"; } export function getDoList3(arg) { arg = convertArgToJson(arg); diff --git a/backend/yjs/search.yjs b/backend/yjs/search.yjs index c367413..aff5b73 100755 --- a/backend/yjs/search.yjs +++ b/backend/yjs/search.yjs @@ -35,7 +35,7 @@ module SearchModule { export function getPageInfo(arg) { var data = executeContract("Registry", "getPageInfo", arg).result.data; return { - "code" : 0, "data" :data + "code" : 0, "data" : data }; } export function getAllDoCount() { @@ -44,19 +44,20 @@ module SearchModule { "code" : 0, "data" : data.doCount }; } - //TODO??? export function getAllIndexCount() { var data = executeContract("Registry", "getPageInfo", arg).result.data; return { "code" : 0, "data" : data.updateCount }; } + @ArgSchema({ + "!doId" : "string" + }) export function getDoCount(arg) { - var ret = executeContract("Registry", "getDoCount", arg); - if (arg.indexOf("shanxi/Repository") != - 1) - ret.result.data.push({ - "doId" : "shanxi/Repository", "count" : 3 - }); + var ret = executeContract("Registry", "getDoCount", JSON.stringify(arg)); + if (arg.doId.indexOf("shanxi/Repository") != - 1){ + return {"code":0,"data":3}; + } return ret.result; } @@ -110,30 +111,26 @@ module SearchModule { //返回:{"data":[{},{},{}],"count":3} @ArgSchema({ "!params" : [{ - "!type" : "string", "!keyword" : "integer" + "!type" : "string", "!keyword" : "string", "mode" : "string" }], "count" : "integer", "offset" : "integer" }) export function search(arg) { arg = convertArgToJson(arg); - var req = {"id":"","attributes":{},"body":""}; - for (var i=0;i