Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
link33
plugin
Commits
cba65734
Commit
cba65734
authored
May 20, 2019
by
linj
Committed by
vipwzw
May 21, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix unfreeze create 因为参数中有oneof 不能直接从 json unmarshal的问题, 现在格式 和 pb2json 的格式一致
parent
75165456
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
1 deletion
+44
-1
test-rpc.sh
plugin/dapp/unfreeze/cmd/build/test-rpc.sh
+1
-1
tx.go
plugin/dapp/unfreeze/types/tx.go
+43
-0
No files found.
plugin/dapp/unfreeze/cmd/build/test-rpc.sh
View file @
cba65734
...
@@ -167,7 +167,7 @@ function init() {
...
@@ -167,7 +167,7 @@ function init() {
}
}
function CreateRawUnfreezeCreate() {
function CreateRawUnfreezeCreate() {
req='{"
jsonrpc
": "
2
.0
", "
method
" : "
Chain33
.CreateTransaction
" , "
params
":[ {"
execer
" : "
unfreeze
", "
actionName
" :"
createUnfreeze
","
payload
":{"
startTime
":10000,"
assetExec
":"
coins
","
assetSymbol
":"
bty
","
totalCount
":400000000,"
beneficiary
":"
'$beneficiary'
","
means
":"
FixAmount
","
fixAmount
": {"
period
":10,"
amount
":1000000}
}}]}'
req='{"
jsonrpc
": "
2
.0
", "
method
" : "
unfreeze
.CreateRawUnfreezeCreate
" , "
params
":[{"
startTime
":10000,"
assetExec
":"
coins
","
assetSymbol
":"
bty
","
totalCount
":400000000,"
beneficiary
":"
'$beneficiary'
","
means
":"
FixAmount
","
fixAmount
": {"
period
":10,"
amount
":1000000
}}]}'
# echo "
#request
:
$req
"
# echo "
#request
:
$req
"
resp=
$(
curl
-ksd
"
$req
"
"
${
MAIN_HTTP
}
"
)
resp=
$(
curl
-ksd
"
$req
"
"
${
MAIN_HTTP
}
"
)
# echo "
#resp
:
$resp
"
# echo "
#resp
:
$resp
"
...
...
plugin/dapp/unfreeze/types/tx.go
View file @
cba65734
...
@@ -3,3 +3,46 @@
...
@@ -3,3 +3,46 @@
// license that can be found in the LICENSE file.
// license that can be found in the LICENSE file.
package
types
package
types
import
(
"encoding/json"
"github.com/33cn/chain33/types"
)
type
MeansOpt
struct
{
FixAmount
*
FixAmount
`json:"FixAmount,omitempty"`
LeftProportion
*
LeftProportion
`json:"LeftProportion,omitempty"`
}
type
parseUnfreezeCreate
struct
{
StartTime
int64
`protobuf:"varint,1,opt,name=startTime,proto3" json:"startTime,omitempty"`
AssetExec
string
`protobuf:"bytes,2,opt,name=assetExec,proto3" json:"assetExec,omitempty"`
AssetSymbol
string
`protobuf:"bytes,3,opt,name=assetSymbol,proto3" json:"assetSymbol,omitempty"`
TotalCount
int64
`protobuf:"varint,4,opt,name=totalCount,proto3" json:"totalCount,omitempty"`
Beneficiary
string
`protobuf:"bytes,5,opt,name=beneficiary,proto3" json:"beneficiary,omitempty"`
Means
string
`protobuf:"bytes,6,opt,name=means,proto3" json:"means,omitempty"`
// MeansOpt MeansOpt `json:"MeansOpt,omitempty"`
FixAmount
*
FixAmount
`json:"fixAmount,omitempty"`
LeftProportion
*
LeftProportion
`json:"leftProportion,omitempty"`
}
func
(
m
*
UnfreezeCreate
)
UnmarshalJSON
(
v
[]
byte
)
error
{
var
c
parseUnfreezeCreate
err
:=
json
.
Unmarshal
(
v
,
&
c
)
if
err
!=
nil
{
return
err
}
if
c
.
Means
==
FixAmountX
&&
c
.
FixAmount
!=
nil
{
m
.
MeansOpt
=
&
UnfreezeCreate_FixAmount
{
FixAmount
:
c
.
FixAmount
}
}
else
if
c
.
Means
==
LeftProportionX
&&
c
.
LeftProportion
!=
nil
{
m
.
MeansOpt
=
&
UnfreezeCreate_LeftProportion
{
LeftProportion
:
c
.
LeftProportion
}
}
else
{
return
types
.
ErrInvalidParam
}
m
.
StartTime
=
c
.
StartTime
m
.
AssetSymbol
,
m
.
AssetExec
=
c
.
AssetSymbol
,
c
.
AssetExec
m
.
TotalCount
,
m
.
Beneficiary
=
c
.
TotalCount
,
c
.
Beneficiary
m
.
Means
=
c
.
Means
return
nil
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment