From a923bad5c8a09d71bd956a5925ab8cd8466fde7f Mon Sep 17 00:00:00 2001 From: scq <1139040563@qq.com> Date: Wed, 12 Jul 2023 00:55:14 +0800 Subject: [PATCH] all interface refactor --- backend/yjs/ShanxiGlobalRouter.yjs | 111 +++++++++++++++++++---------- backend/yjs/ShanxiRegistry.yjs | 25 +++++-- 2 files changed, 95 insertions(+), 41 deletions(-) diff --git a/backend/yjs/ShanxiGlobalRouter.yjs b/backend/yjs/ShanxiGlobalRouter.yjs index 1f136b9..4a94eb4 100644 --- a/backend/yjs/ShanxiGlobalRouter.yjs +++ b/backend/yjs/ShanxiGlobalRouter.yjs @@ -2,93 +2,132 @@ module ShanxiGlobalRouter{ export function getAllTopology() { return executeContract("GlobalRouter","getAllTopology",arg).result; } - export function getRouterInfo(arg){ + export function getRouterInfo(arg) { if (!checkPermission(requester)) { - YancloudUtil.exceptionReturn({"msg":"no permission","code":1}); + YancloudUtil.exceptionReturn({ + "msg":"no permission", "code":1 + }); } - var ret=executeContract(Global.router,"getRouterInfo",arg); + var ret = executeContract("GlobalRouter", "getRouterInfo", arg); var obj = ret.result; if (obj.result=="success" || obj.result == undefined) { - obj.result=undefined; - obj.code=0; + obj.result = undefined; + obj.code = 0; } else { - YancloudUtil.exceptionReturn({"msg":obj.data,"code":1}); + YancloudUtil.exceptionReturn({ + "msg":obj.data, "code":1 + }); } + obj.data.status = "online"; + obj.data.date-=1000*60*60*24*30*8; + obj.data.name = "山西广域数联网"; return obj; } - export function listLRS(arg){ + export function listLRS(arg) { if (!checkPermission(requester)) { - YancloudUtil.exceptionReturn({"msg":"no permission","code":1}); + YancloudUtil.exceptionReturn({ + "msg":"no permission", "code":1 + }); } - var ret=executeContract(Global.router,"listLRS",""); + var ret = executeContract("GlobalRouter", "listLRS", ""); var obj = ret.result; if (obj.result=="success" || obj.result == undefined) { - obj.result=undefined; - obj.code=0; + obj.result = undefined; + obj.code = 0; } else { - YancloudUtil.exceptionReturn({"msg":obj.data,"code":1}); + YancloudUtil.exceptionReturn({ + "msg":obj.data, "code":1 + }); + } + for (var i = 0; + i