Commit eee32aab authored by vipwzw's avatar vipwzw

auto ci

parent 7c308c64
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
package executor package executor
import ( import (
"fmt"
"encoding/hex" "encoding/hex"
"fmt"
"strconv" "strconv"
"github.com/33cn/chain33/common" "github.com/33cn/chain33/common"
...@@ -54,7 +54,7 @@ var opt_order_table = &table.Option{ ...@@ -54,7 +54,7 @@ var opt_order_table = &table.Option{
"owner_isSell", // 接口 6 "owner_isSell", // 接口 6
// "owner_isSell_status", 可能需求, 界面分开显示订单 // "owner_isSell_status", 可能需求, 界面分开显示订单
// "owner_isSell_statusPrefix", // 状态可以定制组合, 成交历史需求 // "owner_isSell_statusPrefix", // 状态可以定制组合, 成交历史需求
"owner_status", // 接口 2 "owner_status", // 接口 2
"assset_isSell_isFinished", // 用 isFinish, 进行订单是否完成的列表功能 "assset_isSell_isFinished", // 用 isFinish, 进行订单是否完成的列表功能
"owner_asset_isFinished", "owner_asset_isFinished",
"owner_isFinished", "owner_isFinished",
...@@ -146,7 +146,7 @@ func (r *OrderRow) isFinished() int { ...@@ -146,7 +146,7 @@ func (r *OrderRow) isFinished() int {
// 进行中, 撤销, 部分成交 , 全部成交, 完成状态统一前缀. 数字和原来不一样 // 进行中, 撤销, 部分成交 , 全部成交, 完成状态统一前缀. 数字和原来不一样
// 01 10 11 12 19 -> 1* // 01 10 11 12 19 -> 1*
func (r *OrderRow) status() string { func (r *OrderRow) status() string {
if r.Status == pty.TradeOrderStatusOnBuy || r.Status == pty.TradeOrderStatusOnSale{ if r.Status == pty.TradeOrderStatusOnBuy || r.Status == pty.TradeOrderStatusOnSale {
return "01" // 试图用1 可以匹配所有完成的 return "01" // 试图用1 可以匹配所有完成的
} else if r.Status == pty.TradeOrderStatusSoldOut || r.Status == pty.TradeOrderStatusBoughtOut { } else if r.Status == pty.TradeOrderStatusSoldOut || r.Status == pty.TradeOrderStatusBoughtOut {
return "12" return "12"
...@@ -291,7 +291,7 @@ func (t *trade) genSellMarket(tx *types.Transaction, sell *pty.ReceiptSellBase, ...@@ -291,7 +291,7 @@ func (t *trade) genSellMarket(tx *types.Transaction, sell *pty.ReceiptSellBase,
IsSellOrder: true, IsSellOrder: true,
AssetExec: sell.AssetExec, AssetExec: sell.AssetExec,
IsFinished: true, IsFinished: true,
} }
return order return order
} }
......
package executor package executor
import ( import (
pty "github.com/33cn/plugin/plugin/dapp/trade/types"
"github.com/33cn/chain33/system/dapp"
"testing" "testing"
"github.com/33cn/chain33/system/dapp"
pty "github.com/33cn/plugin/plugin/dapp/trade/types"
//"github.com/33cn/chain33/common/db" //"github.com/33cn/chain33/common/db"
//"github.com/33cn/chain33/common/db/table" //"github.com/33cn/chain33/common/db/table"
"github.com/33cn/chain33/util" "github.com/33cn/chain33/util"
...@@ -11,48 +12,47 @@ import ( ...@@ -11,48 +12,47 @@ import (
) )
var order1 = &pty.LocalOrder{ var order1 = &pty.LocalOrder{
AssetSymbol: "A", AssetSymbol: "A",
Owner: "O1", Owner: "O1",
AmountPerBoardlot: 1, AmountPerBoardlot: 1,
MinBoardlot: 1, MinBoardlot: 1,
PricePerBoardlot: 1, PricePerBoardlot: 1,
TotalBoardlot: 10, TotalBoardlot: 10,
TradedBoardlot: 0, TradedBoardlot: 0,
BuyID: "B1", BuyID: "B1",
Status: pty.TradeOrderStatusOnBuy, Status: pty.TradeOrderStatusOnBuy,
SellID: "", SellID: "",
TxHash: nil, TxHash: nil,
Height: 1, Height: 1,
Key: "B1", Key: "B1",
BlockTime: 1, BlockTime: 1,
IsSellOrder: false, IsSellOrder: false,
AssetExec: "a", AssetExec: "a",
TxIndex: dapp.HeightIndexStr(1, 1), TxIndex: dapp.HeightIndexStr(1, 1),
IsFinished: false, IsFinished: false,
} }
var order2 = &pty.LocalOrder{ var order2 = &pty.LocalOrder{
AssetSymbol: "A", AssetSymbol: "A",
Owner: "O1", Owner: "O1",
AmountPerBoardlot: 1, AmountPerBoardlot: 1,
MinBoardlot: 1, MinBoardlot: 1,
PricePerBoardlot: 1, PricePerBoardlot: 1,
TotalBoardlot: 10, TotalBoardlot: 10,
TradedBoardlot: 0, TradedBoardlot: 0,
BuyID: "B2", BuyID: "B2",
Status: pty.TradeOrderStatusOnBuy, Status: pty.TradeOrderStatusOnBuy,
SellID: "", SellID: "",
TxHash: nil, TxHash: nil,
Height: 2, Height: 2,
Key: "B2", Key: "B2",
BlockTime: 2, BlockTime: 2,
IsSellOrder: false, IsSellOrder: false,
AssetExec: "a", AssetExec: "a",
TxIndex: dapp.HeightIndexStr(2, 1), TxIndex: dapp.HeightIndexStr(2, 1),
IsFinished: false, IsFinished: false,
} }
func TestListAll(t *testing.T) { func TestListAll(t *testing.T) {
dir, ldb, tdb := util.CreateTestDB() dir, ldb, tdb := util.CreateTestDB()
t.Log(dir, ldb, tdb) t.Log(dir, ldb, tdb)
......
...@@ -662,7 +662,6 @@ func (t *trade) GetOnesOrderWithStatusV1(req *pty.ReqAddrAssets) (types.Message, ...@@ -662,7 +662,6 @@ func (t *trade) GetOnesOrderWithStatusV1(req *pty.ReqAddrAssets) (types.Message,
return nil, types.ErrInvalidParam return nil, types.ErrInvalidParam
} }
keys, err := t.GetLocalDB().List(calcOnesOrderPrefixStatus(req.Addr, orderStatus), fromKey, req.Count, req.Direction) keys, err := t.GetLocalDB().List(calcOnesOrderPrefixStatus(req.Addr, orderStatus), fromKey, req.Count, req.Direction)
if err != nil { if err != nil {
return nil, err return nil, err
...@@ -717,22 +716,22 @@ func (t *trade) GetOnesOrderWithStatus(req *pty.ReqAddrAssets) (types.Message, e ...@@ -717,22 +716,22 @@ func (t *trade) GetOnesOrderWithStatus(req *pty.ReqAddrAssets) (types.Message, e
func fmtReply(order *pty.LocalOrder) *pty.ReplyTradeOrder { func fmtReply(order *pty.LocalOrder) *pty.ReplyTradeOrder {
return &pty.ReplyTradeOrder{ return &pty.ReplyTradeOrder{
TokenSymbol: order.AssetSymbol, TokenSymbol: order.AssetSymbol,
Owner: order.Owner, Owner: order.Owner,
AmountPerBoardlot: order.AmountPerBoardlot, AmountPerBoardlot: order.AmountPerBoardlot,
MinBoardlot: order.MinBoardlot, MinBoardlot: order.MinBoardlot,
PricePerBoardlot: order.PricePerBoardlot, PricePerBoardlot: order.PricePerBoardlot,
TotalBoardlot: order.TotalBoardlot, TotalBoardlot: order.TotalBoardlot,
TradedBoardlot: order.TradedBoardlot, TradedBoardlot: order.TradedBoardlot,
BuyID: order.BuyID, BuyID: order.BuyID,
Status: order.Status, Status: order.Status,
SellID: order.SellID, SellID: order.SellID,
TxHash: order.TxHash[0], TxHash: order.TxHash[0],
Height: order.Height, Height: order.Height,
Key: order.TxIndex, Key: order.TxIndex,
BlockTime: order.BlockTime, BlockTime: order.BlockTime,
IsSellOrder: order.IsSellOrder, IsSellOrder: order.IsSellOrder,
AssetExec: order.AssetExec, AssetExec: order.AssetExec,
} }
} }
......
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