gpt4 book ai didi

javascript - 如何在 Hyperledger Composer 中查找特定 Assets 和参与者的交易是否已经存在?

转载 作者:行者123 更新时间:2023-12-03 02:08:17 25 4
gpt4 key购买 nike

Participant 
IDFC

Participant
TATA , MRF

Asset
FINANCEPROGRAM

Transaction
(Data need to submit)
participant(TATA) ,Asset (FINANCEPROGRAM ) ,loanAmount , loantenure

我需要检查FINANCEPROGRAM和TATA的交易是否已经存在。

如果存在,我需要拒绝交易。

var query1 = query('SELECT com.ett.blockchain.Programmeben WHERE (beneficiary == _$beneficiary AND bankprogramme == _$bank program) ');

return query('query1',{beneficiary : 'resource:com.ett.blockchain.Beneficiary #'+pgben.beneficiary .customerid,bankprogram: 'resource:com.ett.blockchain.Bankprogramme#'+pgben.bankprogramme.programmeid})

.then(function (transactions1) {

transactions1.forEach(function (trans1) {

console.log("transaction exist " );

});

throw Error("Transaction already exist");

});

最佳答案

您缺少 buildQuery 语句。

例如

var query1 = buildQuery('SELECT com.ett.blockchain.Programmeben WHERE (beneficiary == _$beneficiary AND bankprogramme == _$bank program) ');

return query(query1, { beneficiary : 'resource:com.ett.blockchain.Beneficiary#' + pgben.beneficiary.customerid, bankprogram: 'resource:com.ett.blockchain.Bankprogramme#' + pgben.bankprogramme.programmeid } )

请参阅此处的示例(特别是“Javascript 代码 js”部分)-> Why are the following added assets not persisted in the hyperledger registry?

关于javascript - 如何在 Hyperledger Composer 中查找特定 Assets 和参与者的交易是否已经存在?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49693066/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com