node.js - 在 Hyperledger 作曲家中特定天数后发出事件
问题描述
模型文件中称为Contract
havecontract_start_date
和contract_end_date
properties 的资产。我想在contract_end_date
.
模型文件:
asset Contract identified by contractId {
o String contractId
o DateTime contract_start_date
o DateTime contract_end_date
}
transaction set_Dates {
--> Contract contract
o DateTime start_date
o DateTime end_date
}
event end_Date_Reached {
o String message
}
/**
* In the logic.js file
*/
async function setDate (tx) {
tx.contract.contract_start_date = tx.start_date;
tx.contract.contract_end_date = tx.end_date;
// get the Contract asset from registry
let contractRegistry = await getAssetRegistry('org.test.sample.Contract');
await contractRegistry.update(tx.contract); // update the registry
}
如何end_Date_Reached
通过检查contract_end_date
属性的值来发出事件?任何帮助将不胜感激!
解决方案
推荐阅读
- mysql - 输出两个关联表的总计的查询没有正确返回总计,为什么?
- java - 为什么 Oracle 仍然为非开发人员桌面 JRE 提供 Java 8?
- python - 我可以从以前运行的 python 脚本中读取代码吗
- java - 在二维数组 Java 中绘制数字菱形
- nginx - 不能在 Nginx 上用 FFmpeg 直播?
- python - 如何为空单元格 csv 文件返回 none 或 0
- c - C/Linux 指针和文件读取 - 分段错误?
- javascript - 如何在 Google Sheet App Script 中使用 JS 库?
- mysql - Excel VBA:ODBC 驱动程序管理器]未找到数据源名称且未指定默认驱动程序
- bash - ${TF_CFLAGS[@]} 的含义