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
1ab627b0
Commit
1ab627b0
authored
Sep 03, 2019
by
linj
Committed by
vipwzw
Sep 05, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分离查询相关代码, 避免误修改导致接口不兼容
parent
e55fd991
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
35 deletions
+41
-35
query.go
plugin/dapp/trade/executor/query.go
+0
-35
query_v1.go
plugin/dapp/trade/executor/query_v1.go
+41
-0
No files found.
plugin/dapp/trade/executor/query.go
View file @
1ab627b0
...
...
@@ -24,11 +24,6 @@ import (
// 由于现价买/卖是没有orderID的, 用txhash 代替作为key
// key 有两种 orderID, txhash (0xAAAAAAAAAAAAAAA)
// 根据token 分页显示未完成成交卖单
func
(
t
*
trade
)
Query_GetTokenSellOrderByStatus
(
req
*
pty
.
ReqTokenSellOrder
)
(
types
.
Message
,
error
)
{
return
t
.
GetTokenSellOrderByStatus
(
req
,
req
.
Status
)
}
// 根据token 分页显示未完成成交买单
func
(
t
*
trade
)
Query_GetTokenBuyOrderByStatus
(
req
*
pty
.
ReqTokenBuyOrder
)
(
types
.
Message
,
error
)
{
if
req
.
Status
==
0
{
...
...
@@ -184,36 +179,6 @@ func (t *trade) GetOnesBuyOrdersWithStatus(req *pty.ReqAddrAssets) (types.Messag
return
&
replys
,
nil
}
func
(
t
*
trade
)
GetTokenSellOrderByStatus
(
req
*
pty
.
ReqTokenSellOrder
,
status
int32
)
(
types
.
Message
,
error
)
{
if
req
.
Count
<=
0
||
(
req
.
Direction
!=
1
&&
req
.
Direction
!=
0
)
{
return
nil
,
types
.
ErrInvalidParam
}
fromKey
:=
[]
byte
(
""
)
if
len
(
req
.
FromKey
)
!=
0
{
sell
:=
t
.
replyReplySellOrderfromID
([]
byte
(
req
.
FromKey
))
if
sell
==
nil
{
tradelog
.
Error
(
"GetTokenSellOrderByStatus"
,
"key not exist"
,
req
.
FromKey
)
return
nil
,
types
.
ErrInvalidParam
}
fromKey
=
calcTokensSellOrderKeyStatus
(
sell
.
TokenSymbol
,
sell
.
Status
,
calcPriceOfToken
(
sell
.
PricePerBoardlot
,
sell
.
AmountPerBoardlot
),
sell
.
Owner
,
sell
.
Key
)
}
values
,
err
:=
t
.
GetLocalDB
()
.
List
(
calcTokensSellOrderPrefixStatus
(
req
.
TokenSymbol
,
status
),
fromKey
,
req
.
Count
,
req
.
Direction
)
if
err
!=
nil
{
return
nil
,
err
}
var
replys
pty
.
ReplyTradeOrders
for
_
,
key
:=
range
values
{
reply
:=
t
.
loadOrderFromKey
(
key
)
if
reply
==
nil
{
continue
}
replys
.
Orders
=
append
(
replys
.
Orders
,
reply
)
}
return
&
replys
,
nil
}
func
(
t
*
trade
)
GetTokenBuyOrderByStatus
(
req
*
pty
.
ReqTokenBuyOrder
,
status
int32
)
(
types
.
Message
,
error
)
{
if
req
.
Count
<=
0
||
(
req
.
Direction
!=
1
&&
req
.
Direction
!=
0
)
{
return
nil
,
types
.
ErrInvalidParam
...
...
plugin/dapp/trade/executor/query_v1.go
0 → 100644
View file @
1ab627b0
package
executor
import
(
"github.com/33cn/chain33/types"
pty
"github.com/33cn/plugin/plugin/dapp/trade/types"
)
// 根据token 分页显示未完成成交卖单
func
(
t
*
trade
)
Query_GetTokenSellOrderByStatus
(
req
*
pty
.
ReqTokenSellOrder
)
(
types
.
Message
,
error
)
{
return
t
.
GetTokenSellOrderByStatus
(
req
,
req
.
Status
)
}
func
(
t
*
trade
)
GetTokenSellOrderByStatus
(
req
*
pty
.
ReqTokenSellOrder
,
status
int32
)
(
types
.
Message
,
error
)
{
if
req
.
Count
<=
0
||
(
req
.
Direction
!=
1
&&
req
.
Direction
!=
0
)
{
return
nil
,
types
.
ErrInvalidParam
}
fromKey
:=
[]
byte
(
""
)
if
len
(
req
.
FromKey
)
!=
0
{
sell
:=
t
.
replyReplySellOrderfromID
([]
byte
(
req
.
FromKey
))
if
sell
==
nil
{
tradelog
.
Error
(
"GetTokenSellOrderByStatus"
,
"key not exist"
,
req
.
FromKey
)
return
nil
,
types
.
ErrInvalidParam
}
fromKey
=
calcTokensSellOrderKeyStatus
(
sell
.
TokenSymbol
,
sell
.
Status
,
calcPriceOfToken
(
sell
.
PricePerBoardlot
,
sell
.
AmountPerBoardlot
),
sell
.
Owner
,
sell
.
Key
)
}
values
,
err
:=
t
.
GetLocalDB
()
.
List
(
calcTokensSellOrderPrefixStatus
(
req
.
TokenSymbol
,
status
),
fromKey
,
req
.
Count
,
req
.
Direction
)
if
err
!=
nil
{
return
nil
,
err
}
var
replys
pty
.
ReplyTradeOrders
for
_
,
key
:=
range
values
{
reply
:=
t
.
loadOrderFromKey
(
key
)
if
reply
==
nil
{
continue
}
replys
.
Orders
=
append
(
replys
.
Orders
,
reply
)
}
return
&
replys
,
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