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
f941df38
Commit
f941df38
authored
Dec 18, 2019
by
vipwzw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto ci
parent
ef3012f1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
14 deletions
+18
-14
exchangedb.go
plugin/dapp/exchange/executor/exchangedb.go
+1
-0
query.go
plugin/dapp/exchange/executor/query.go
+1
-1
tables.go
plugin/dapp/exchange/executor/tables.go
+4
-5
exchange.go
plugin/dapp/exchange/types/exchange.go
+5
-4
exchange.pb.go
plugin/dapp/exchange/types/exchange.pb.go
+7
-4
No files found.
plugin/dapp/exchange/executor/exchangedb.go
View file @
f941df38
...
...
@@ -6,6 +6,7 @@ import (
"github.com/33cn/chain33/account"
"github.com/33cn/chain33/client"
//"github.com/33cn/chain33/common"
dbm
"github.com/33cn/chain33/common/db"
.
"github.com/33cn/chain33/common/db/table"
...
...
plugin/dapp/exchange/executor/query.go
View file @
f941df38
...
...
@@ -35,7 +35,7 @@ func (s *exchange) Query_QueryCompletedOrderList(in *et.QueryCompletedOrderList)
if
!
CheckDirection
(
in
.
Direction
)
{
return
nil
,
et
.
ErrDirection
}
return
QueryCompletedOrderList
(
s
.
GetLocalDB
(),
in
.
LeftAsset
,
in
.
RightAsset
,
in
.
PrimaryKey
,
in
.
Count
,
in
.
Direction
)
return
QueryCompletedOrderList
(
s
.
GetLocalDB
(),
in
.
LeftAsset
,
in
.
RightAsset
,
in
.
PrimaryKey
,
in
.
Count
,
in
.
Direction
)
}
//根据orderID查询订单信息
...
...
plugin/dapp/exchange/executor/tables.go
View file @
f941df38
...
...
@@ -34,6 +34,7 @@ var opt_exchange_depth = &table.Option{
Primary
:
"price"
,
Index
:
nil
,
}
//重新设计表,list查询全部在订单信息localdb查询中
var
opt_exchange_order
=
&
table
.
Option
{
Prefix
:
KeyPrefixLocalDB
,
...
...
@@ -57,7 +58,6 @@ var opt_exchange_completed = &table.Option{
Index
:
nil
,
}
//NewTable 新建表
func
NewMarketDepthTable
(
kvdb
db
.
KV
)
*
table
.
Table
{
rowmeta
:=
NewMarketDepthRow
()
...
...
@@ -121,8 +121,8 @@ func (r *OrderRow) SetPayload(data types.Message) error {
//Get 按照indexName 查询 indexValue
func
(
r
*
OrderRow
)
Get
(
key
string
)
([]
byte
,
error
)
{
if
key
==
"orderID"
{
return
[]
byte
(
fmt
.
Sprintf
(
"%022d"
,
r
.
OrderID
)),
nil
}
else
if
key
==
"market_order"
{
return
[]
byte
(
fmt
.
Sprintf
(
"%022d"
,
r
.
OrderID
)),
nil
}
else
if
key
==
"market_order"
{
return
[]
byte
(
fmt
.
Sprintf
(
"%s:%s:%d:%016d"
,
r
.
GetLimitOrder
()
.
LeftAsset
.
GetSymbol
(),
r
.
GetLimitOrder
()
.
RightAsset
.
GetSymbol
(),
r
.
GetLimitOrder
()
.
Op
,
int64
(
Truncate
(
r
.
GetLimitOrder
()
.
Price
*
float64
(
1e8
))))),
nil
}
return
nil
,
types
.
ErrNotFound
...
...
@@ -154,7 +154,7 @@ func (r *UserOrderRow) SetPayload(data types.Message) error {
//Get 按照indexName 查询 indexValue
func
(
r
*
UserOrderRow
)
Get
(
key
string
)
([]
byte
,
error
)
{
if
key
==
"index"
{
if
key
==
"index"
{
return
[]
byte
(
fmt
.
Sprintf
(
"%s:%d:%022d"
,
r
.
Addr
,
r
.
Status
,
r
.
Index
)),
nil
}
return
nil
,
types
.
ErrNotFound
...
...
@@ -169,7 +169,6 @@ func NewCompletedOrderRow() *CompletedOrderRow {
return
&
CompletedOrderRow
{
Order
:
&
ety
.
Order
{
Value
:
&
ety
.
Order_LimitOrder
{
LimitOrder
:
&
ety
.
LimitOrder
{}}}}
}
func
(
m
*
CompletedOrderRow
)
CreateRow
()
*
table
.
Row
{
return
&
table
.
Row
{
Data
:
&
ety
.
Order
{
Value
:
&
ety
.
Order_LimitOrder
{
LimitOrder
:
&
ety
.
LimitOrder
{}}}}
}
...
...
plugin/dapp/exchange/types/exchange.go
View file @
f941df38
package
types
import
(
"github.com/33cn/chain33/types"
"reflect"
"github.com/33cn/chain33/types"
)
/*
...
...
@@ -74,9 +75,9 @@ var (
}
//定义log的id和具体log类型及名称,填入具体自定义log类型
logMap
=
map
[
int64
]
*
types
.
LogInfo
{
TyLimitOrderLog
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptExchange
{}),
Name
:
"TyLimitOrderLog"
},
TyMarketOrderLog
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptExchange
{}),
Name
:
"TyMarketOrderLog"
},
TyRevokeOrderLog
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptExchange
{}),
Name
:
"TyRevokeOrderLog"
},
TyLimitOrderLog
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptExchange
{}),
Name
:
"TyLimitOrderLog"
},
TyMarketOrderLog
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptExchange
{}),
Name
:
"TyMarketOrderLog"
},
TyRevokeOrderLog
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptExchange
{}),
Name
:
"TyRevokeOrderLog"
},
}
//tlog = log.New("module", "exchange.types")
)
...
...
plugin/dapp/exchange/types/exchange.pb.go
View file @
f941df38
...
...
@@ -26,12 +26,15 @@ It has these top-level messages:
*/
package
types
import
proto
"github.com/golang/protobuf/proto"
import
fmt
"fmt"
import
math
"math"
import
(
fmt
"fmt"
proto
"github.com/golang/protobuf/proto"
math
"math"
context
"golang.org/x/net/context"
grpc
"google.golang.org/grpc"
)
...
...
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