feat: format code move type def

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
2019-07-11 21:54:41 +08:00
parent f8fcab7929
commit 92a1edb789
5 changed files with 116 additions and 70 deletions

View File

@@ -58,8 +58,7 @@ function DoCommand(response, Type, Path, params, remoteAddress) {
try {
var Str = JSON.stringify(Ret);
response.end(Str);
}
catch (e) {
} catch (e) {
global.ToLog("ERR PATH:" + Path);
global.ToLog(e);
response.end();
@@ -202,19 +201,18 @@ function SendBlockFile(response, BlockNum, TrNum) {
if (Block && Block.arrContent) {
SendToResponceFile(response, Block, TrNum);
return;
}
else
} else {
if (!Block || !Block.TrDataPos) {
global.LoadBlockFromNetwork({ BlockNum: BlockNum }, function(Err, Block) {
if (Err) {
SendToResponce404(response);
}
else {
} else {
SendToResponceFile(response, Block, TrNum);
}
});
return;
}
}
}
SendToResponce404(response);
};
@@ -230,8 +228,7 @@ function SendToResponceFile(response, Block, TrNum) {
else
response.writeHead(200, { 'Content-Type': TR.ContentType });
response.end(TR.Data);
}
else {
} else {
SendToResponce404(response);
}
};
@@ -250,19 +247,18 @@ HTTPCaller.DappBlockFile = function(Params, response) {
if (Block && Block.arrContent) {
SendToResponceDappFile(response, Block, Params.TrNum);
return null;
}
else
} else {
if (!Block || !Block.TrDataPos) {
global.LoadBlockFromNetwork(Params, function(Err, Block) {
if (Err) {
SendToResponceResult0(response);
}
else {
} else {
SendToResponceDappFile(response, Block, Params.TrNum);
}
});
return null;
}
}
}
return { result: 0 };
};
@@ -275,8 +271,7 @@ function SendToResponceDappFile(response, Block, TrNum) {
if (Type === global.TYPE_TRANSACTION_FILE) {
var TR = global.DApps.File.GetObjectTransaction(Body);
Result = { result: 1, Type: Type, ContentType: TR.ContentType, Name: TR.Name, Body: TR.Data.toString('utf8') };
}
else {
} else {
var App = global.DAppByType[Type];
if (App) {
Body = JSON.parse(App.GetScriptTransaction(Body));
@@ -306,8 +301,7 @@ HTTPCaller.DappStaticCall = function(Params, response) {
var RetValue;
try {
RetValue = global.RunSmartMethod(glBlock0, Account.Value.Smart, Account, 0, 0, undefined, Params.MethodName, Params.Params, 1);
}
catch (e) {
} catch (e) {
return { result: 0, RetValue: "" + e };
}
var Str = JSON.stringify({ result: 1, RetValue: RetValue });