提交 de55ce16 编写于 作者: swbsin's avatar swbsin 提交者: GitHub

Update chaincode_example04.md

上级 3d04f187
......@@ -18,28 +18,150 @@
- 所在位置
- 账号地址
- 账号公钥
- 账户私钥
- 学校学生
- 个人
- 姓名
- 账号地址
- 过往学历
- 学历信息
- 学历信息编号
- 就读学校
- 就读年份
- 完成就读年份
- 就读状态 //0:毕业 1:退学
- 修改记录(入学也相当于一种修改记录)
- 编号
- 学校账户地址(一般根据账户地址可以算出公钥地址,然后可以进行校验)
- 学校签名
- 个人账户地址
- 个人公钥地址(个人不需要公钥地址)
- 修改时间
- 修改操作//0:正常毕业 1:退学 2:入学
对学历操作信息所有的操作都归为记录。
#### function及各自实现的功能
- `init` 初始化函数,并创建一所学校
- `invoke` 调用合约内部的函数
- `query` 查询相关的信息
- `updateDiploma` 由学校更新学生学历信息,并签名
- `enrollStudent` 学校招生
- `addSchool` 添加一名新学校
- `addStudent` 添加一名新学生
- `getStudentByAddress` 通过学生的地址访问学生的账号信息
- `updateDiploma` 由学校更新学生学历信息,并签名(返回记录信息) invoke
- `enrollStudent` 学校招生(返回学校信息) invoke
- `createSchool` 添加一名新学校 init
- `createStudent` 添加一名新学生 init
- `getStudentByAddress` 通过学生的地址访问学生的学历信息 query
- `getRecordById` 通过Id获取记录 query
- `getRecords` 获取全部记录(如果记录数大于10,返回前10个) query
- `getSchoolByAddress` 通过地址获取学校的信息
- `getBackgroundById` 通过地点获取所存储的学历信息
- `writeRecord` 写入记录
- `writeSchool` 写入新创建的学校
- `writeStudent` 写入新创建的学生
#### 接口设计
`createSchool`
request参数:
```
args[0] 学校名称
args[1] 学校所在位置
```
response参数:
```
学校信息的json表示,当创建一所新学校时,该学校学生账户地址列表为空
```
`createStudent`
request参数:
```
args[0] 学生的姓名
```
response参数:
```
学生信息的json表示,刚创建过往学历信息列表为空
```
`updateDiploma`
request参数
```
args[0] 学校账户地址
args[1] 学校签名
args[2] 待修改学生的账户地址
args[3] //对该学生的学历进行怎样的修改,0:正常毕业 1:退学
```
response参数
```
返回修改记录的json表示
```
`enrollStudent`
request参数:
```
args[0] 学校账户地址
args[1] 学校签名
args[2] 学生账户地址
```
response参数
```
返回修改记录的json表示
```
`getStudentByAddress`
request参数
```
args[0] address
```
response参数
```
学生信息的json表示
```
`getRecordById`
request参数
```
args[0] 修改记录的ID
```
response参数
```
修改记录的json表示
```
`getRecords`
response参数
```
获取修改记录数组(如果个数大于10,返回前10个)
```
`getSchoolByAddress`
request参数
```
args[0] address
```
response参数
```
学校信息的json表示
```
`getBackgroundById`
request参数
```
args[0] ID
```
response参数
```
学历信息的json表示
```
#### 测试
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册