Commit a117a368 authored by jiangpeng's avatar jiangpeng

dapp/vote:update doc

parent 814bb16c
...@@ -91,17 +91,19 @@ func decodeCommitInfo(data []byte) *vty.CommitInfo { ...@@ -91,17 +91,19 @@ func decodeCommitInfo(data []byte) *vty.CommitInfo {
func classifyVoteList(infos *vty.VoteInfos) *vty.ReplyVoteList { func classifyVoteList(infos *vty.VoteInfos) *vty.ReplyVoteList {
reply := &vty.ReplyVoteList{} reply := &vty.ReplyVoteList{}
currentTime := types.Now().Unix()
for _, voteInfo := range infos.GetVoteList() { for _, voteInfo := range infos.GetVoteList() {
if voteInfo.Status == voteStatusClosed { if voteInfo.Status == voteStatusClosed {
reply.ClosedList = append(reply.ClosedList, voteInfo) reply.ClosedList = append(reply.ClosedList, voteInfo)
} else if voteInfo.BeginTimestamp > types.Now().Unix() { } else if voteInfo.BeginTimestamp > currentTime {
reply.PendingList = append(reply.PendingList, voteInfo) reply.PendingList = append(reply.PendingList, voteInfo)
} else if voteInfo.EndTimestamp > types.Now().Unix() { } else if voteInfo.EndTimestamp > currentTime {
reply.OngoingList = append(reply.OngoingList, voteInfo) reply.OngoingList = append(reply.OngoingList, voteInfo)
} else { } else {
reply.FinishedList = append(reply.FinishedList, voteInfo) reply.FinishedList = append(reply.FinishedList, voteInfo)
} }
} }
reply.CurrentTimestamp = currentTime
return reply return reply
} }
...@@ -23,7 +23,7 @@ message GroupMember { ...@@ -23,7 +23,7 @@ message GroupMember {
//创建投票组 //创建投票组
message CreateGroup { message CreateGroup {
string name = 1; //投票组名称 string name = 1; //投票组名称
repeated string admins = 2; //管理员地址列表 repeated string admins = 2; //管理员地址列表,创建者默认为管理员
repeated GroupMember members = 3; //组员 repeated GroupMember members = 3; //组员
string description = 4; //描述 string description = 4; //描述
} }
...@@ -138,4 +138,5 @@ message ReplyVoteList { ...@@ -138,4 +138,5 @@ message ReplyVoteList {
repeated VoteInfo ongoingList = 2; //正在进行投票列表 repeated VoteInfo ongoingList = 2; //正在进行投票列表
repeated VoteInfo finishedList = 3; //已经完成投票列表 repeated VoteInfo finishedList = 3; //已经完成投票列表
repeated VoteInfo closedList = 4; //已经关闭投票列表 repeated VoteInfo closedList = 4; //已经关闭投票列表
int64 currentTimestamp = 5;
} }
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
//创建投票组 //创建投票组
message CreateGroup { message CreateGroup {
string name = 1; //投票组名称 string name = 1; //投票组名称
repeated string admins = 2; //管理员地址列表 repeated string admins = 2; //管理员地址列表, 创建者默认为管理员
repeated GroupMember members = 3; //组员 repeated GroupMember members = 3; //组员
string description = 4; //描述 string description = 4; //描述
} }
...@@ -349,12 +349,13 @@ curl -kd '{"method":"Chain33.Query","params":[{"execer":"vote","funcName":"GetM ...@@ -349,12 +349,13 @@ curl -kd '{"method":"Chain33.Query","params":[{"execer":"vote","funcName":"GetM
``` ```
#### 获取投票组列表(ListGroup) #### 获取投票组列表(ListGroup)
全局投票组有序列表
##### 请求结构 ##### 请求结构
```proto ```proto
//列表请求结构 //列表请求结构
message ReqListItem { message ReqListItem {
string startItemID = 1; //列表开始的ID,如请求组列表即groupID,不包含在结果中 string startItemID = 1; //列表开始的投票组ID,不包含在结果中
int32 count = 2; //列表项单次请求数量 int32 count = 2; //列表项单次请求数量
int32 direction = 3; // 0表示根据ID降序,1表示升序 int32 direction = 3; // 0表示根据ID降序,1表示升序
} }
...@@ -377,17 +378,17 @@ curl -kd '{"method":"Chain33.Query","params":[{"execer":"vote","funcName":"List ...@@ -377,17 +378,17 @@ curl -kd '{"method":"Chain33.Query","params":[{"execer":"vote","funcName":"List
``` ```
#### 获取投票列表(ListVote) #### 获取投票列表(ListVote)
获取全局投票列表, 指定groupID时,则获取指定组的投票列表
##### 请求结构 ##### 请求结构
```proto ```proto
//列表请求结构 //列表请求结构
message ReqListVote { message ReqListVote {
string groupID = 1; //所属组ID string groupID = 1; //所属组ID,不填时获取全局的投票列表
ReqListItem listReq = 2; //列表请求 ReqListItem listReq = 2; //列表请求
} }
message ReqListItem { message ReqListItem {
string startItemID = 1; //列表开始的ID,如请求组列表即groupID,不包含在结果中 string startItemID = 1; //列表开始的投票ID,不包含在结果中
int32 count = 2; //列表项单次请求数量 int32 count = 2; //列表项单次请求数量
int32 direction = 3; // 0表示根据ID降序,1表示升序 int32 direction = 3; // 0表示根据ID降序,1表示升序
} }
...@@ -414,13 +415,14 @@ curl -kd '{"method":"Chain33.Query","params":[{"execer":"vote","funcName":"List ...@@ -414,13 +415,14 @@ curl -kd '{"method":"Chain33.Query","params":[{"execer":"vote","funcName":"List
``` ```
#### 获取用户列表(ListMember) #### 获取用户列表(ListMember)
全局用户有序列表
##### 请求结构 ##### 请求结构
```proto ```proto
//列表请求结构 //列表请求结构
message ReqListItem { message ReqListItem {
string startItemID = 1; //列表开始的ID,如请求组列表即groupID,不包含在结果中 string startItemID = 1; //列表开始的用户ID(地址)
int32 count = 2; //列表项单次请求数量 int32 count = 2; //列表项单次请求数量
int32 direction = 3; // 0表示根据ID降序,1表示升序 int32 direction = 3; // 0表示根据ID降序,1表示升序
} }
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment