public object getRes(JsonRPCrequest req, string reqAddr) { JArray result = null; try { point(req.method); switch (req.method) { // case "getContractList": result = blockService.getContractList( int.Parse(req.@params[0].ToString()), int.Parse(req.@params[1].ToString())); break; // case "getScanTxCountHist": result = blockService.getScanTxCountHist(); break; case "getScanStatistic": result = blockService.getScanStatistic(); break; // case "getInnerTxAtContractDetail": result = innerTxService.getInnerTxAtContractDetail( req.@params[0].ToString(), int.Parse(req.@params[1].ToString()), int.Parse(req.@params[2].ToString()) ); break; case "getInnerTxAtAddrDetail": result = innerTxService.getInnerTxAtAddrDetail( req.@params[0].ToString(), int.Parse(req.@params[1].ToString()), int.Parse(req.@params[2].ToString()) ); break; case "getInnerTxAtTxDetail": result = innerTxService.getInnerTxAtTxDetail( req.@params[0].ToString() ); break; case "getInnerTxAtTxList": result = innerTxService.getInnerTxAtTxList( int.Parse(req.@params[0].ToString()), int.Parse(req.@params[1].ToString()) ); break; // 获取合约信息 case "getContractNep5Tx": result = contractService.getContractNep5Tx(req.@params[0].ToString(), int.Parse(req.@params[1].ToString()), int.Parse(req.@params[2].ToString())); break; // 获取合约信息 case "getContractCallTx": result = contractService.getContractCallTx(req.@params[0].ToString(), int.Parse(req.@params[1].ToString()), int.Parse(req.@params[2].ToString())); break; // 获取合约信息 case "getContractInfo": result = contractService.getContractInfo(req.@params[0].ToString()); break; // 获取服务列表 case "getServiceList": result = daoService.getServiceList(int.Parse(req.@params[0].ToString()), int.Parse(req.@params[1].ToString())); break; case "getUserInfo": result = daoService.getUserInfo(req.@params[0].ToString()); break; case "getHashInfoByVoteHash": result = daoService.getHashInfoByVoteHash(req.@params[0].ToString()); break; // 获取治理信息列表(治理) case "getVoteTxHistList": result = daoService.getVoteTxHistList(req.@params[0].ToString(), int.Parse(req.@params[1].ToString()), int.Parse(req.@params[2].ToString())); break; // 获取治理信息(治理) case "getVoteInfo": result = daoService.getVoteInfo(req.@params[0].ToString()); break; // 获取项目交易历史列表(众筹) case "getProjTxHistList": if ([email protected] > 3) { result = daoService.getProjTxHistList(req.@params[0].ToString(), int.Parse(req.@params[1].ToString()), int.Parse(req.@params[2].ToString()), req.@params[3].ToString()); break; } result = daoService.getProjTxHistList(req.@params[0].ToString(), int.Parse(req.@params[1].ToString()), int.Parse(req.@params[2].ToString())); break; // 获取项目信息(众筹) case "getProjInfo": result = daoService.getProjInfo(req.@params[0].ToString()); break; // 存储治理信息(治理) case "storeVoteInfo": result = daoService.storeVoteInfo(req.@params[0].ToString(), req.@params[1].ToString(), req.@params[2].ToString(), req.@params[3].ToString(), req.@params[4].ToString(), req.@params[5].ToString(), req.@params[6].ToString(), req.@params[7].ToString()); break; // 存储项目信息(众筹) case "storeProjInfo": result = daoService.storeProjInfo(req.@params[0].ToString(), req.@params[1].ToString(), req.@params[2].ToString(), req.@params[3].ToString(), req.@params[4].ToString(), req.@params[5].ToString(), req.@params[5].ToString()); break; // ..... case "getNep5TxlistByAddress": if ([email protected] < 3) { result = blockService.getNep5TxlistByAddress(req.@params[0].ToString()); } else { result = blockService.getNep5TxlistByAddress(req.@params[0].ToString(), int.Parse(req.@params[1].ToString()), int.Parse(req.@params[2].ToString())); } break; case "getNep5Txlist": if ([email protected] < 2) { result = blockService.getNep5Txlist(); } else { result = blockService.getNep5Txlist(int.Parse(req.@params[0].ToString()), int.Parse(req.@params[1].ToString())); } break; // case "getMappingDomain": result = nnsDomainCrediteService.getMappingDomain(req.@params[0].ToString()); break; // case "getNNSFixedSellingList": if ([email protected] < 1) { result = nnsService.getNNSFixedSellingList(); } else if ([email protected] < 3) { result = nnsService.getNNSFixedSellingList(req.@params[0].ToString(), req.@params[1].ToString()); } else if ([email protected] < 5) { result = nnsService.getNNSFixedSellingList(req.@params[0].ToString(), req.@params[1].ToString(), int.Parse(req.@params[2].ToString()), int.Parse(req.@params[3].ToString())); } else { result = nnsService.getNNSFixedSellingList(req.@params[0].ToString(), req.@params[1].ToString(), int.Parse(req.@params[2].ToString()), int.Parse(req.@params[3].ToString()), req.@params[4].ToString()); } break; // 获取域名流转历史 case "getDomainTransferHist": if ([email protected] < 3) { result = domainService.getDomainTransferAndSellingInfo(req.@params[0].ToString()); } else { result = domainService.getDomainTransferAndSellingInfo(req.@params[0].ToString(), int.Parse(req.@params[1].ToString()), int.Parse(req.@params[2].ToString())); } break; case "getutxolistbyaddress": if ([email protected] < 3) { result = blockService.getutxolistbyaddress(req.@params[0].ToString()); } else { result = blockService.getutxolistbyaddress(req.@params[0].ToString(), int.Parse(req.@params[1].ToString()), int.Parse(req.@params[2].ToString())); } break; case "gettransactionlist": if ([email protected] < 2) { result = blockService.gettransactionlist(); } else if ([email protected] < 3) { result = blockService.gettransactionlist(int.Parse(req.@params[0].ToString()), int.Parse(req.@params[1].ToString())); } else { result = blockService.gettransactionlist(int.Parse(req.@params[0].ToString()), int.Parse(req.@params[1].ToString()), req.@params[2].ToString()); } break; case "getutxoinfo": result = blockService.getutxoinfo(req.@params[0].ToString()); break; case "getnep5transferinfo": break; case "getdomaininfo": result = domainService.getDomainInfo(req.@params[0].ToString()); break; case "getauctioninfoTx": if ([email protected] < 3) { result = domainService.getAuctionInfoTx(req.@params[0].ToString()); } else { result = domainService.getAuctionInfoTx(req.@params[0].ToString(), int.Parse(req.@params[1].ToString()), int.Parse(req.@params[2].ToString())); } break; case "getauctioninfoRank": if ([email protected] < 3) { result = domainService.getAuctionInfoRank(req.@params[0].ToString()); } else { result = domainService.getAuctionInfoRank(req.@params[0].ToString(), int.Parse(req.@params[1].ToString()), int.Parse(req.@params[2].ToString())); } break; case "getauctioninfo": result = domainService.getAuctionInfo(req.@params[0].ToString()); break; case "getauctionres": result = domainService.getAuctionRes(req.@params[0].ToString()); break; case "searchbydomain": result = domainService.searchByDomain(req.@params[0].ToString()); break; // 最具价值域名 case "getaucteddomain": if ([email protected] < 2) { result = nnsService.getUsedDomainList(); } else { result = nnsService.getUsedDomainList(int.Parse(req.@params[0].ToString()), int.Parse(req.@params[1].ToString())); } break; // 正在竞拍域名 case "getauctingdomainbymaxprice": if ([email protected] < 2) { result = nnsService.getAuctingDomainListByMaxPrice(); } else { result = nnsService.getAuctingDomainListByMaxPrice(int.Parse(req.@params[0].ToString()), int.Parse(req.@params[1].ToString())); } break; case "getauctingdomain": if ([email protected] < 2) { result = nnsService.getAuctingDomainList(); } else { result = nnsService.getAuctingDomainList(int.Parse(req.@params[0].ToString()), int.Parse(req.@params[1].ToString())); } break; // statistics(奖金池+已领分红+已使用域名数量+正在竞拍域名数量) case "getstatistics": result = nnsService.getStatistic(); break; // 资产名称模糊查询 case "fuzzysearchasset": if ([email protected] >= 3) { result = assetService.fuzzySearchAsset(req.@params[0].ToString(), int.Parse(req.@params[1].ToString()), int.Parse(req.@params[2].ToString())); break; } result = assetService.fuzzySearchAsset(req.@params[0].ToString()); break; // case "getaddresstxs": result = analyService.getAddressTxsNew(req.@params[0].ToString(), int.Parse(req.@params[1].ToString()), int.Parse(req.@params[2].ToString())); break; case "getrankbyasset": result = analyService.getRankByAsset(req.@params[0].ToString(), int.Parse(req.@params[1].ToString()), int.Parse(req.@params[2].ToString()), netnode); break; case "getrankbyassetcount": result = analyService.getRankByAssetCount(req.@params[0].ToString(), netnode); break; // test case "getnodetype": result = new JArray { new JObject { { "nodeType", netnode } } }; break; } if (result.Count == 0) { JsonPRCresponse_Error resE = new JsonPRCresponse_Error(req.id, -1, "No Data", "Data does not exist"); return(resE); } } catch (Exception e) { Console.WriteLine("errMsg:{0},errStack:{1}", e.Message, e.StackTrace); JsonPRCresponse_Error resE = new JsonPRCresponse_Error(req.id, -100, "Parameter Error", e.Message); return(resE); } JsonPRCresponse res = new JsonPRCresponse(); res.jsonrpc = req.jsonrpc; res.id = req.id; res.result = result; return(res); }
public object getRes(JsonRPCrequest req, string reqAddr) // change this part which is reading mongodb to read mysql, takes JsonRequest which is the api link , string address and returns a JArray object { JArray result = null; try { switch (req.method) // check the method (method to retrieve specific data) in the api link { case "getauctioninfoTx": if ([email protected] < 3) // if the params array has less than 3 objects // params length decide which methods to use; 3 is comserv , 2 is nnServe , { result = commonService.getAuctionInfoTx(req.@params[0].ToString()); } else { result = commonService.getAuctionInfoTx(req.@params[0].ToString(), int.Parse(req.@params[1].ToString()), int.Parse(req.@params[2].ToString())); } break; case "getauctioninfoRank": if ([email protected] < 3) { result = commonService.getAuctionInfoRank(req.@params[0].ToString()); } else { result = commonService.getAuctionInfoRank(req.@params[0].ToString(), int.Parse(req.@params[1].ToString()), int.Parse(req.@params[2].ToString())); } break; case "getauctioninfo": result = commonService.getAuctionInfo(req.@params[0].ToString()); break; case "searchbydomain": result = commonService.searchByDomain(req.@params[0].ToString()); break; // 最具价值域名 case "getaucteddomain": if ([email protected] < 2) { result = nnsService.getUsedDomainListNew(); } else { result = nnsService.getUsedDomainListNew(int.Parse(req.@params[0].ToString()), int.Parse(req.@params[1].ToString())); } break; // 正在竞拍域名 case "getauctingdomainbymaxprice": if ([email protected] < 2) { result = nnsService.getAuctingDomainListNewByMaxPrice(); } else { result = nnsService.getAuctingDomainListNewByMaxPrice(int.Parse(req.@params[0].ToString()), int.Parse(req.@params[1].ToString())); } break; case "getauctingdomain": if ([email protected] < 2) { result = nnsService.getAuctingDomainListNew(); } else { result = nnsService.getAuctingDomainListNew(int.Parse(req.@params[0].ToString()), int.Parse(req.@params[1].ToString())); } break; // statistics(奖金池+已领分红+已使用域名数量+正在竞拍域名数量) case "getstatistics": result = nnsService.getStatistic(); break; // 资产名称模糊查询 case "fuzzysearchasset": result = assetService.fuzzySearchAsset(req.@params[0].ToString()); break; case "getaddresstxss": result = analyService.getAddressTxsNew(req.@params[0].ToString(), int.Parse(req.@params[1].ToString()), int.Parse(req.@params[2].ToString())); break; case "getrankbyasset": result = msq.GetRankByAsset(req); break; case "getrankbyassetcount": result = msq.GetRankByAssetCount(req); break; // test case "getnodetype": result = new JArray { new JObject { { "nodeType", netnode } } }; break; case "getaddr": //string addr = req.@params[0].ToString(); result = msq.GetAddress(req); break; case "getaddrcount": //string addr = req.@params[0].ToString(); result = msq.GetAddrCount(req); break; case "getaddresstxs": result = msq.GetAddressTx(req); break; case "getasset": result = msq.GetAsset(req); break; case "getallasset": result = msq.GetAllAsset(req); break; case "getnep5asset": result = msq.GetNep5Asset(req); break; case "getallnep5assets": result = msq.GetAllNep5Asset(req); break; case "getnep5transfer": result = msq.GetNep5Transfer(req); break; case "getallnep5transfer": result = msq.GetAllNep5Transfers(req); break; case "getnotify": result = msq.GetNotify(req); break; case "gettx": result = msq.GetTx(req); break; case "getutxo": result = msq.GetUTXO(req); break; case "gettxcount": result = msq.GetTxCount(req); break; case "getblockcount": result = msq.GetBlockCount(req); break; case "getblock": result = msq.GetBlock(req); break; case "getblocktime": result = msq.GetBlockTime(req); break; case "getblocks": result = msq.GetBlocks(req); break; case "getaddress": result = msq.GetAddress(req); break; } if (result.Count == 0) { JsonPRCresponse_Error resE = new JsonPRCresponse_Error(req.id, -1, "No Data", "Data does not exist"); return(resE); } } catch (Exception e) { Console.WriteLine("errMsg:{0},errStack:{1}", e.Message, e.StackTrace); JsonPRCresponse_Error resE = new JsonPRCresponse_Error(req.id, -100, "Parameter Error", e.Message); return(resE); } JsonPRCresponse res = new JsonPRCresponse(); res.jsonrpc = req.jsonrpc; res.id = req.id; res.result = result; return(res); }