Commit eee32aab authored by vipwzw's avatar vipwzw

auto ci

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