Пример #1
0
        public async Task <TxResponse> QueryTx(string chaincode, string func, string[] args)
        {
            var tx = new QMBlockSDK.TX.TxHeader();

            tx.ChannelId     = _channelId;
            tx.Args          = args;
            tx.FuncName      = func;
            tx.ChaincodeName = chaincode;
            return(await _tx.QueryTx(tx));
        }
Пример #2
0
        //查询配置
        public async Task <ChannelConfig> QueryChannelConfigAsync(string channelId)
        {
            var txHeader = new QMBlockSDK.TX.TxHeader();

            txHeader.ChannelId     = channelId;
            txHeader.ChaincodeName = ConfigKey.SysNetConfigChaincode;
            txHeader.FuncName      = ConfigKey.QueryChannelConfig;
            txHeader.Args          = new string[0];
            txHeader.Type          = TxType.Query;
            var rs = await _txService.QueryTx(txHeader);

            if (rs.Status)
            {
                return(rs.Data as ChannelConfig);
            }
            else
            {
                throw new Exception(rs.Msg);
            }
        }
Пример #3
0
        //member.query
        //[Authorize(Roles = "Admin,User,Reader")]
        public override async Task <TxResponse> QueryTx(TxHeader request, ServerCallContext context)
        {
            try
            {
                var model = Newtonsoft.Json.JsonConvert.DeserializeObject <QMBlockSDK.TX.TxHeader>(request.Data);
                var rs    = await _txService.QueryTx(model);

                return(new TxResponse()
                {
                    Data = Newtonsoft.Json.JsonConvert.SerializeObject(rs)
                });
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, ex.Message);
                var rs = new QMBlockSDK.TX.TxResponse();
                rs.Msg    = ex.Message;
                rs.Status = false;
                return(new TxResponse()
                {
                    Data = Newtonsoft.Json.JsonConvert.SerializeObject(rs)
                });
            }
        }
Пример #4
0
        public async Task <JsonResult> QueryTx(TxHeader request)
        {
            var rs = await _txService.QueryTx(request);

            return(new JsonResult(rs));
        }