Commit 43c631f6 authored by 张振华's avatar 张振华

lint

parent 5c0ea3b1
...@@ -13,6 +13,7 @@ import ( ...@@ -13,6 +13,7 @@ import (
"strings" "strings"
) )
//GuessCmd Guess合约命令行
func GuessCmd() *cobra.Command { func GuessCmd() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "guess", Use: "guess",
...@@ -32,6 +33,7 @@ func GuessCmd() *cobra.Command { ...@@ -32,6 +33,7 @@ func GuessCmd() *cobra.Command {
return cmd return cmd
} }
//GuessStartRawTxCmd 构造Guess合约的start原始交易(未签名)的命令行
func GuessStartRawTxCmd() *cobra.Command { func GuessStartRawTxCmd() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "start", Use: "start",
...@@ -107,6 +109,7 @@ func guessStart(cmd *cobra.Command, args []string) { ...@@ -107,6 +109,7 @@ func guessStart(cmd *cobra.Command, args []string) {
ctx.RunWithoutMarshal() ctx.RunWithoutMarshal()
} }
//GuessBetRawTxCmd 构造Guess合约的bet原始交易(未签名)的命令行
func GuessBetRawTxCmd() *cobra.Command { func GuessBetRawTxCmd() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "bet", Use: "bet",
...@@ -129,13 +132,13 @@ func addGuessBetFlags(cmd *cobra.Command) { ...@@ -129,13 +132,13 @@ func addGuessBetFlags(cmd *cobra.Command) {
func guessBet(cmd *cobra.Command, args []string) { func guessBet(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr") rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
gameId, _ := cmd.Flags().GetString("gameId") gameID, _ := cmd.Flags().GetString("gameId")
option, _ := cmd.Flags().GetString("option") option, _ := cmd.Flags().GetString("option")
betsNumber, _ := cmd.Flags().GetInt64("betsNumber") betsNumber, _ := cmd.Flags().GetInt64("betsNumber")
fee, _ := cmd.Flags().GetFloat64("fee") fee, _ := cmd.Flags().GetFloat64("fee")
params := &pkt.GuessBetTxReq{ params := &pkt.GuessBetTxReq{
GameId: gameId, GameId: gameID,
Option: option, Option: option,
Bets: betsNumber, Bets: betsNumber,
Fee: int64(fee * float64(1e8)), Fee: int64(fee * float64(1e8)),
...@@ -146,6 +149,7 @@ func guessBet(cmd *cobra.Command, args []string) { ...@@ -146,6 +149,7 @@ func guessBet(cmd *cobra.Command, args []string) {
ctx.RunWithoutMarshal() ctx.RunWithoutMarshal()
} }
//GuessStopBetRawTxCmd 构造Guess合约的停止下注(stopBet)原始交易(未签名)的命令行
func GuessStopBetRawTxCmd() *cobra.Command { func GuessStopBetRawTxCmd() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "stop bet", Use: "stop bet",
...@@ -164,11 +168,11 @@ func addGuessStopBetFlags(cmd *cobra.Command) { ...@@ -164,11 +168,11 @@ func addGuessStopBetFlags(cmd *cobra.Command) {
func guessStopBet(cmd *cobra.Command, args []string) { func guessStopBet(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr") rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
gameId, _ := cmd.Flags().GetString("gameId") gameID, _ := cmd.Flags().GetString("gameId")
fee, _ := cmd.Flags().GetFloat64("fee") fee, _ := cmd.Flags().GetFloat64("fee")
params := &pkt.GuessStopBetTxReq{ params := &pkt.GuessStopBetTxReq{
GameId: gameId, GameId: gameID,
Fee: int64(fee * float64(1e8)), Fee: int64(fee * float64(1e8)),
} }
...@@ -177,7 +181,7 @@ func guessStopBet(cmd *cobra.Command, args []string) { ...@@ -177,7 +181,7 @@ func guessStopBet(cmd *cobra.Command, args []string) {
ctx.RunWithoutMarshal() ctx.RunWithoutMarshal()
} }
//GuessAbortRawTxCmd 构造Guess合约的撤销(Abort)原始交易(未签名)的命令行
func GuessAbortRawTxCmd() *cobra.Command { func GuessAbortRawTxCmd() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "abort", Use: "abort",
...@@ -196,10 +200,10 @@ func addGuessAbortFlags(cmd *cobra.Command) { ...@@ -196,10 +200,10 @@ func addGuessAbortFlags(cmd *cobra.Command) {
func guessAbort(cmd *cobra.Command, args []string) { func guessAbort(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr") rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
gameId, _ := cmd.Flags().GetString("gameId") gameID, _ := cmd.Flags().GetString("gameId")
fee, _ := cmd.Flags().GetFloat64("fee") fee, _ := cmd.Flags().GetFloat64("fee")
params := &pkt.GuessAbortTxReq{ params := &pkt.GuessAbortTxReq{
GameId: gameId, GameId: gameID,
Fee: int64(fee * float64(1e8)), Fee: int64(fee * float64(1e8)),
} }
...@@ -208,6 +212,7 @@ func guessAbort(cmd *cobra.Command, args []string) { ...@@ -208,6 +212,7 @@ func guessAbort(cmd *cobra.Command, args []string) {
ctx.RunWithoutMarshal() ctx.RunWithoutMarshal()
} }
//GuessPublishRawTxCmd 构造Guess合约的发布结果(Publish)原始交易(未签名)的命令行
func GuessPublishRawTxCmd() *cobra.Command { func GuessPublishRawTxCmd() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "publish", Use: "publish",
...@@ -230,12 +235,12 @@ func addGuessPublishFlags(cmd *cobra.Command) { ...@@ -230,12 +235,12 @@ func addGuessPublishFlags(cmd *cobra.Command) {
func guessPublish(cmd *cobra.Command, args []string) { func guessPublish(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr") rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
gameId, _ := cmd.Flags().GetString("gameId") gameID, _ := cmd.Flags().GetString("gameId")
result, _ := cmd.Flags().GetString("result") result, _ := cmd.Flags().GetString("result")
fee, _ := cmd.Flags().GetFloat64("fee") fee, _ := cmd.Flags().GetFloat64("fee")
params := &pkt.GuessPublishTxReq{ params := &pkt.GuessPublishTxReq{
GameId: gameId, GameId: gameID,
Result: result, Result: result,
Fee: int64(fee * float64(1e8)), Fee: int64(fee * float64(1e8)),
} }
...@@ -245,7 +250,7 @@ func guessPublish(cmd *cobra.Command, args []string) { ...@@ -245,7 +250,7 @@ func guessPublish(cmd *cobra.Command, args []string) {
ctx.RunWithoutMarshal() ctx.RunWithoutMarshal()
} }
//GuessQueryRawTxCmd 构造Guess合约的查询(Query)命令行
func GuessQueryRawTxCmd() *cobra.Command { func GuessQueryRawTxCmd() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "query", Use: "query",
...@@ -270,7 +275,7 @@ func addGuessQueryFlags(cmd *cobra.Command) { ...@@ -270,7 +275,7 @@ func addGuessQueryFlags(cmd *cobra.Command) {
func guessQuery(cmd *cobra.Command, args []string) { func guessQuery(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr") rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
ty, _ := cmd.Flags().GetInt32("type") ty, _ := cmd.Flags().GetInt32("type")
gameId, _ := cmd.Flags().GetString("gameId") gameID, _ := cmd.Flags().GetString("gameId")
addr, _ := cmd.Flags().GetString("addr") addr, _ := cmd.Flags().GetString("addr")
adminAddr, _ := cmd.Flags().GetString("adminAddr") adminAddr, _ := cmd.Flags().GetString("adminAddr")
status, _ := cmd.Flags().GetInt32("status") status, _ := cmd.Flags().GetInt32("status")
...@@ -304,7 +309,7 @@ func guessQuery(cmd *cobra.Command, args []string) { ...@@ -304,7 +309,7 @@ func guessQuery(cmd *cobra.Command, args []string) {
case 2: case 2:
req := &pkt.QueryGuessGameInfo{ req := &pkt.QueryGuessGameInfo{
GameId: gameId, GameId: gameID,
} }
params.FuncName = pkt.FuncName_QueryGameById params.FuncName = pkt.FuncName_QueryGameById
params.Payload = types.MustPBToJSON(req) params.Payload = types.MustPBToJSON(req)
......
...@@ -9,26 +9,31 @@ import ( ...@@ -9,26 +9,31 @@ import (
pkt "github.com/33cn/plugin/plugin/dapp/guess/types" pkt "github.com/33cn/plugin/plugin/dapp/guess/types"
) )
//Exec_Start Guess执行器创建游戏
func (c *Guess) Exec_Start(payload *pkt.GuessGameStart, tx *types.Transaction, index int) (*types.Receipt, error) { func (c *Guess) Exec_Start(payload *pkt.GuessGameStart, tx *types.Transaction, index int) (*types.Receipt, error) {
action := NewAction(c, tx, index) action := NewAction(c, tx, index)
return action.GameStart(payload) return action.GameStart(payload)
} }
//Exec_Bet Guess执行器参与游戏
func (c *Guess) Exec_Bet(payload *pkt.GuessGameBet, tx *types.Transaction, index int) (*types.Receipt, error) { func (c *Guess) Exec_Bet(payload *pkt.GuessGameBet, tx *types.Transaction, index int) (*types.Receipt, error) {
action := NewAction(c, tx, index) action := NewAction(c, tx, index)
return action.GameBet(payload) return action.GameBet(payload)
} }
//Exec_StopBet Guess执行器停止游戏下注
func (c *Guess) Exec_StopBet(payload *pkt.GuessGameStopBet, tx *types.Transaction, index int) (*types.Receipt, error) { func (c *Guess) Exec_StopBet(payload *pkt.GuessGameStopBet, tx *types.Transaction, index int) (*types.Receipt, error) {
action := NewAction(c, tx, index) action := NewAction(c, tx, index)
return action.GameStopBet(payload) return action.GameStopBet(payload)
} }
//Exec_Publish Guess执行器公布游戏结果
func (c *Guess) Exec_Publish(payload *pkt.GuessGamePublish, tx *types.Transaction, index int) (*types.Receipt, error) { func (c *Guess) Exec_Publish(payload *pkt.GuessGamePublish, tx *types.Transaction, index int) (*types.Receipt, error) {
action := NewAction(c, tx, index) action := NewAction(c, tx, index)
return action.GamePublish(payload) return action.GamePublish(payload)
} }
//Exec_Abort Guess执行器撤销未结束游戏
func (c *Guess) Exec_Abort(payload *pkt.GuessGameAbort, tx *types.Transaction, index int) (*types.Receipt, error) { func (c *Guess) Exec_Abort(payload *pkt.GuessGameAbort, tx *types.Transaction, index int) (*types.Receipt, error) {
action := NewAction(c, tx, index) action := NewAction(c, tx, index)
return action.GameAbort(payload) return action.GameAbort(payload)
......
...@@ -76,18 +76,22 @@ func (g *Guess) execDelLocal(receiptData *types.ReceiptData) (*types.LocalDBSet, ...@@ -76,18 +76,22 @@ func (g *Guess) execDelLocal(receiptData *types.ReceiptData) (*types.LocalDBSet,
return dbSet, nil return dbSet, nil
} }
//ExecDelLocal_Start Guess执行器Start交易撤销
func (g *Guess) ExecDelLocal_Start(payload *pkt.GuessGameStart, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) { func (g *Guess) ExecDelLocal_Start(payload *pkt.GuessGameStart, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
return g.execLocal(receiptData) return g.execLocal(receiptData)
} }
//ExecDelLocal_Bet Guess执行器Bet交易撤销
func (g *Guess) ExecDelLocal_Bet(payload *pkt.GuessGameBet, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) { func (g *Guess) ExecDelLocal_Bet(payload *pkt.GuessGameBet, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
return g.execLocal(receiptData) return g.execLocal(receiptData)
} }
//ExecDelLocal_Publish Guess执行器Publish交易撤销
func (g *Guess) ExecDelLocal_Publish(payload *pkt.GuessGamePublish, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) { func (g *Guess) ExecDelLocal_Publish(payload *pkt.GuessGamePublish, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
return g.execLocal(receiptData) return g.execLocal(receiptData)
} }
//ExecDelLocal_Abort Guess执行器Abort交易撤销
func (g *Guess) ExecDelLocal_Abort(payload *pkt.GuessGameAbort, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) { func (g *Guess) ExecDelLocal_Abort(payload *pkt.GuessGameAbort, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
return g.execLocal(receiptData) return g.execLocal(receiptData)
} }
\ No newline at end of file
...@@ -75,22 +75,27 @@ func (g *Guess) execLocal(receipt *types.ReceiptData) (*types.LocalDBSet, error) ...@@ -75,22 +75,27 @@ func (g *Guess) execLocal(receipt *types.ReceiptData) (*types.LocalDBSet, error)
return dbSet, nil return dbSet, nil
} }
//ExecLocal_Start method
func (g *Guess) ExecLocal_Start(payload *pkt.GuessGameStart, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) { func (g *Guess) ExecLocal_Start(payload *pkt.GuessGameStart, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
return g.execLocal(receiptData) return g.execLocal(receiptData)
} }
//ExecLocal_Bet method
func (g *Guess) ExecLocal_Bet(payload *pkt.GuessGameBet, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) { func (g *Guess) ExecLocal_Bet(payload *pkt.GuessGameBet, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
return g.execLocal(receiptData) return g.execLocal(receiptData)
} }
//ExecLocal_StopBet method
func (g *Guess) ExecLocal_StopBet(payload *pkt.GuessGameStopBet, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) { func (g *Guess) ExecLocal_StopBet(payload *pkt.GuessGameStopBet, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
return g.execLocal(receiptData) return g.execLocal(receiptData)
} }
//ExecLocal_Publish method
func (g *Guess) ExecLocal_Publish(payload *pkt.GuessGamePublish, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) { func (g *Guess) ExecLocal_Publish(payload *pkt.GuessGamePublish, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
return g.execLocal(receiptData) return g.execLocal(receiptData)
} }
//ExecLocal_Abort method
func (g *Guess) ExecLocal_Abort(payload *pkt.GuessGameAbort, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) { func (g *Guess) ExecLocal_Abort(payload *pkt.GuessGameAbort, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
return g.execLocal(receiptData) return g.execLocal(receiptData)
} }
\ No newline at end of file
...@@ -39,6 +39,7 @@ func Init(name string, sub []byte) { ...@@ -39,6 +39,7 @@ func Init(name string, sub []byte) {
drivers.Register(driverName, newGuessGame, types.GetDappFork(driverName, "Enable")) drivers.Register(driverName, newGuessGame, types.GetDappFork(driverName, "Enable"))
} }
//Guess 执行器,用于竞猜合约的具体执行
type Guess struct { type Guess struct {
drivers.DriverBase drivers.DriverBase
} }
...@@ -50,10 +51,12 @@ func newGuessGame() drivers.Driver { ...@@ -50,10 +51,12 @@ func newGuessGame() drivers.Driver {
return t return t
} }
//GetName 获取Guess执行器的名称
func GetName() string { func GetName() string {
return newGuessGame().GetName() return newGuessGame().GetName()
} }
//GetDriverName 获取Guess执行器的名称
func (g *Guess) GetDriverName() string { func (g *Guess) GetDriverName() string {
return pkt.GuessX return pkt.GuessX
} }
......
...@@ -21,27 +21,38 @@ import ( ...@@ -21,27 +21,38 @@ import (
) )
const ( const (
//ListDESC 表示记录降序排列
ListDESC = int32(0) ListDESC = int32(0)
//ListASC 表示记录升序排列
ListASC = int32(1) ListASC = int32(1)
DefaultCount = int32(20) //默认一次取多少条记录 //DefaultCount 默认一次获取的记录数
DefaultCount = int32(20)
//DefaultCategory 默认分类
DefaultCategory= "default" DefaultCategory= "default"
MaxBetsOneTime = 10000e8 //一次最多下多少注 //MaxBetsOneTime 一次最多下多少注
MaxBetsNumber = 10000000e8 //一局游戏最多接受多少注 MaxBetsOneTime = 10000e8
MaxBetHeight = 1000000 //距离游戏创建区块的最大可下注高度差
MaxExpireHeight = 1000000 //距离游戏创建区块的最大过期高度差 //MaxBetsNumber 一局游戏最多接受多少注
MaxBetsNumber = 10000000e8
MinBetBlockNum = 720 //从创建游戏开始,一局游戏最少的可下注区块数量 //MaxBetHeight 距离游戏创建区块的最大可下注高度差
MinBetTimeInterval = "2h" //从创建游戏开始,一局游戏最短的可下注时间 MaxBetHeight = 1000000
MinBetTimeoutNum = 8640 //从游戏结束下注开始,一局游戏最少的超时块数
MinBetTimeoutInterval = "24h" //从游戏结束下注开始,一局游戏最短的超时时间
grpcRecSize int = 5 * 30 * 1024 * 1024 //MaxExpireHeight 距离游戏创建区块的最大过期高度差
MaxExpireHeight = 1000000
//grpcRecSize 接收缓冲大小
grpcRecSize int = 30 * 1024 * 1024
//retryNum 失败时的重试次数
retryNum = 10 retryNum = 10
) )
//Action 具体动作执行
type Action struct { type Action struct {
coinsAccount *account.DB coinsAccount *account.DB
db dbm.KV db dbm.KV
...@@ -57,6 +68,7 @@ type Action struct { ...@@ -57,6 +68,7 @@ type Action struct {
grpcClient types.Chain33Client grpcClient types.Chain33Client
} }
//NewAction 生成Action对象
func NewAction(guess *Guess, tx *types.Transaction, index int) *Action { func NewAction(guess *Guess, tx *types.Transaction, index int) *Action {
hash := tx.Hash() hash := tx.Hash()
fromAddr := tx.From() fromAddr := tx.From()
...@@ -90,6 +102,7 @@ func NewAction(guess *Guess, tx *types.Transaction, index int) *Action { ...@@ -90,6 +102,7 @@ func NewAction(guess *Guess, tx *types.Transaction, index int) *Action {
} }
} }
//CheckExecAccountBalance 检查地址在Guess合约中的余额是否足够
func (action *Action) CheckExecAccountBalance(fromAddr string, ToFrozen, ToActive int64) bool { func (action *Action) CheckExecAccountBalance(fromAddr string, ToFrozen, ToActive int64) bool {
acc := action.coinsAccount.LoadExecAccount(fromAddr, action.execaddr) acc := action.coinsAccount.LoadExecAccount(fromAddr, action.execaddr)
if acc.GetBalance() >= ToFrozen && acc.GetFrozen() >= ToActive { if acc.GetBalance() >= ToFrozen && acc.GetFrozen() >= ToActive {
...@@ -98,6 +111,7 @@ func (action *Action) CheckExecAccountBalance(fromAddr string, ToFrozen, ToActiv ...@@ -98,6 +111,7 @@ func (action *Action) CheckExecAccountBalance(fromAddr string, ToFrozen, ToActiv
return false return false
} }
//Key State数据库中存储记录的Key值格式转换
func Key(id string) (key []byte) { func Key(id string) (key []byte) {
//key = append(key, []byte("mavl-"+types.ExecName(pkt.GuessX)+"-")...) //key = append(key, []byte("mavl-"+types.ExecName(pkt.GuessX)+"-")...)
key = append(key, []byte("mavl-"+pkt.GuessX+"-")...) key = append(key, []byte("mavl-"+pkt.GuessX+"-")...)
...@@ -121,6 +135,7 @@ func readGame(db dbm.KV, id string) (*pkt.GuessGame, error) { ...@@ -121,6 +135,7 @@ func readGame(db dbm.KV, id string) (*pkt.GuessGame, error) {
return &game, nil return &game, nil
} }
//Infos 根据游戏id列表查询多个游戏详情信息
func Infos(db dbm.KV, infos *pkt.QueryGuessGameInfos) (types.Message, error) { func Infos(db dbm.KV, infos *pkt.QueryGuessGameInfos) (types.Message, error) {
var games []*pkt.GuessGame var games []*pkt.GuessGame
for i := 0; i < len(infos.GameIds); i++ { for i := 0; i < len(infos.GameIds); i++ {
...@@ -295,6 +310,7 @@ func (action *Action) getIndex() int64 { ...@@ -295,6 +310,7 @@ func (action *Action) getIndex() int64 {
return action.height*types.MaxTxsPerBlock + int64(action.index) return action.height*types.MaxTxsPerBlock + int64(action.index)
} }
//GetReceiptLog 根据游戏信息生成收据记录
func (action *Action) GetReceiptLog(game *pkt.GuessGame, statusChange bool) *types.ReceiptLog { func (action *Action) GetReceiptLog(game *pkt.GuessGame, statusChange bool) *types.ReceiptLog {
log := &types.ReceiptLog{} log := &types.ReceiptLog{}
r := &pkt.ReceiptGuessGame{} r := &pkt.ReceiptGuessGame{}
...@@ -340,12 +356,12 @@ func (action *Action) readGame(id string) (*pkt.GuessGame, error) { ...@@ -340,12 +356,12 @@ func (action *Action) readGame(id string) (*pkt.GuessGame, error) {
} }
// 新建一局游戏 // 新建一局游戏
func (action *Action) newGame(gameId string, start *pkt.GuessGameStart) (*pkt.GuessGame, error) { func (action *Action) newGame(gameID string, start *pkt.GuessGameStart) (*pkt.GuessGame, error) {
game := &pkt.GuessGame{ game := &pkt.GuessGame{
GameId: gameId, GameId: gameID,
Status: pkt.GuessGameActionStart, Status: pkt.GuessGameActionStart,
//StartTime: action.blocktime, //StartTime: action.blocktime,
StartTxHash: gameId, StartTxHash: gameID,
Topic: start.Topic, Topic: start.Topic,
Category: start.Category, Category: start.Category,
Options: start.Options, Options: start.Options,
...@@ -366,7 +382,7 @@ func (action *Action) newGame(gameId string, start *pkt.GuessGameStart) (*pkt.Gu ...@@ -366,7 +382,7 @@ func (action *Action) newGame(gameId string, start *pkt.GuessGameStart) (*pkt.Gu
return game, nil return game, nil
} }
//GameStart 创建游戏动作执行
func (action *Action) GameStart(start *pkt.GuessGameStart) (*types.Receipt, error) { func (action *Action) GameStart(start *pkt.GuessGameStart) (*types.Receipt, error) {
var logs []*types.ReceiptLog var logs []*types.ReceiptLog
var kv []*types.KeyValue var kv []*types.KeyValue
...@@ -385,8 +401,8 @@ func (action *Action) GameStart(start *pkt.GuessGameStart) (*types.Receipt, erro ...@@ -385,8 +401,8 @@ func (action *Action) GameStart(start *pkt.GuessGameStart) (*types.Receipt, erro
if start.MaxBetsNumber >= MaxBetsNumber { if start.MaxBetsNumber >= MaxBetsNumber {
logger.Error("GameStart", "addr", action.fromaddr, "execaddr", action.execaddr, logger.Error("GameStart", "addr", action.fromaddr, "execaddr", action.execaddr,
"err", fmt.Sprintf("The maximum bets number is %d which is less than start.MaxBetsNumber %d", MaxBetsNumber, start.MaxBetsNumber)) "err", fmt.Sprintf("The maximum bets number is %d which is less than start.MaxBetsNumber %d", int64(MaxBetsNumber), start.MaxBetsNumber))
return nil, types.ErrInvalidParam return nil, pkt.ErrOverBetsLimit
} }
if len(start.Topic) == 0 || len(start.Options) == 0 { if len(start.Topic) == 0 || len(start.Options) == 0 {
...@@ -416,8 +432,8 @@ func (action *Action) GameStart(start *pkt.GuessGameStart) (*types.Receipt, erro ...@@ -416,8 +432,8 @@ func (action *Action) GameStart(start *pkt.GuessGameStart) (*types.Receipt, erro
start.MaxBetsOneTime = MaxBetsOneTime start.MaxBetsOneTime = MaxBetsOneTime
} }
gameId := common.ToHex(action.txhash) gameID := common.ToHex(action.txhash)
game, _ := action.newGame(gameId, start) game, _ := action.newGame(gameID, start)
game.StartTime = action.blocktime game.StartTime = action.blocktime
if types.IsPara() { if types.IsPara() {
mainHeight := action.GetMainHeightByTxHash(action.txhash) mainHeight := action.GetMainHeightByTxHash(action.txhash)
...@@ -446,6 +462,7 @@ func (action *Action) GameStart(start *pkt.GuessGameStart) (*types.Receipt, erro ...@@ -446,6 +462,7 @@ func (action *Action) GameStart(start *pkt.GuessGameStart) (*types.Receipt, erro
return &types.Receipt{Ty: types.ExecOk, KV: kv, Logs: logs}, nil return &types.Receipt{Ty: types.ExecOk, KV: kv, Logs: logs}, nil
} }
//GameBet 参与游戏动作执行
func (action *Action) GameBet(pbBet *pkt.GuessGameBet) (*types.Receipt, error) { func (action *Action) GameBet(pbBet *pkt.GuessGameBet) (*types.Receipt, error) {
var logs []*types.ReceiptLog var logs []*types.ReceiptLog
var kv []*types.KeyValue var kv []*types.KeyValue
...@@ -539,6 +556,7 @@ func (action *Action) GameBet(pbBet *pkt.GuessGameBet) (*types.Receipt, error) { ...@@ -539,6 +556,7 @@ func (action *Action) GameBet(pbBet *pkt.GuessGameBet) (*types.Receipt, error) {
return &types.Receipt{Ty: types.ExecOk, KV: kv, Logs: logs}, nil return &types.Receipt{Ty: types.ExecOk, KV: kv, Logs: logs}, nil
} }
//GameStopBet 停止游戏下注动作执行
func (action *Action) GameStopBet(pbBet *pkt.GuessGameStopBet) (*types.Receipt, error) { func (action *Action) GameStopBet(pbBet *pkt.GuessGameStopBet) (*types.Receipt, error) {
var logs []*types.ReceiptLog var logs []*types.ReceiptLog
var kv []*types.KeyValue var kv []*types.KeyValue
...@@ -576,6 +594,7 @@ func (action *Action) GameStopBet(pbBet *pkt.GuessGameStopBet) (*types.Receipt, ...@@ -576,6 +594,7 @@ func (action *Action) GameStopBet(pbBet *pkt.GuessGameStopBet) (*types.Receipt,
return &types.Receipt{Ty: types.ExecOk, KV: kv, Logs: logs}, nil return &types.Receipt{Ty: types.ExecOk, KV: kv, Logs: logs}, nil
} }
//AddGuessBet 向游戏结构中加入下注信息
func (action *Action) AddGuessBet(game *pkt.GuessGame, pbBet *pkt.GuessGameBet) { func (action *Action) AddGuessBet(game *pkt.GuessGame, pbBet *pkt.GuessGameBet) {
bet := &pkt.GuessBet{ Option: pbBet.GetOption(), BetsNumber: pbBet.BetsNum, Index: game.Index} bet := &pkt.GuessBet{ Option: pbBet.GetOption(), BetsNumber: pbBet.BetsNum, Index: game.Index}
player := &pkt.GuessPlayer{ Addr: action.fromaddr, Bet: bet} player := &pkt.GuessPlayer{ Addr: action.fromaddr, Bet: bet}
...@@ -597,6 +616,7 @@ func (action *Action) AddGuessBet(game *pkt.GuessGame, pbBet *pkt.GuessGameBet) ...@@ -597,6 +616,7 @@ func (action *Action) AddGuessBet(game *pkt.GuessGame, pbBet *pkt.GuessGameBet)
game.BetsNumber += pbBet.GetBetsNum() game.BetsNumber += pbBet.GetBetsNum()
} }
//GamePublish 公布竞猜游戏结果动作执行
func (action *Action) GamePublish(publish *pkt.GuessGamePublish) (*types.Receipt, error) { func (action *Action) GamePublish(publish *pkt.GuessGamePublish) (*types.Receipt, error) {
var logs []*types.ReceiptLog var logs []*types.ReceiptLog
var kv []*types.KeyValue var kv []*types.KeyValue
...@@ -740,6 +760,7 @@ func (action *Action) GamePublish(publish *pkt.GuessGamePublish) (*types.Receipt ...@@ -740,6 +760,7 @@ func (action *Action) GamePublish(publish *pkt.GuessGamePublish) (*types.Receipt
return &types.Receipt{Ty: types.ExecOk, KV: kv, Logs: logs}, nil return &types.Receipt{Ty: types.ExecOk, KV: kv, Logs: logs}, nil
} }
//GameAbort 撤销游戏动作执行
func (action *Action) GameAbort(pbend *pkt.GuessGameAbort) (*types.Receipt, error) { func (action *Action) GameAbort(pbend *pkt.GuessGameAbort) (*types.Receipt, error) {
var logs []*types.ReceiptLog var logs []*types.ReceiptLog
var kv []*types.KeyValue var kv []*types.KeyValue
...@@ -804,6 +825,7 @@ func (action *Action) GameAbort(pbend *pkt.GuessGameAbort) (*types.Receipt, erro ...@@ -804,6 +825,7 @@ func (action *Action) GameAbort(pbend *pkt.GuessGameAbort) (*types.Receipt, erro
return &types.Receipt{Ty: types.ExecOk, KV: kv, Logs: logs}, nil return &types.Receipt{Ty: types.ExecOk, KV: kv, Logs: logs}, nil
} }
//GetOptions 获得竞猜选项,并判断是否符合约定格式,类似"A:xxxx;B:xxxx;C:xxx",“:”前为选项名称,不能重复,":"后为选项说明。
func GetOptions(strOptions string) (options []string, legal bool){ func GetOptions(strOptions string) (options []string, legal bool){
legal = true legal = true
items := strings.Split(strOptions, ";") items := strings.Split(strOptions, ";")
...@@ -822,6 +844,7 @@ func GetOptions(strOptions string) (options []string, legal bool){ ...@@ -822,6 +844,7 @@ func GetOptions(strOptions string) (options []string, legal bool){
return options, legal return options, legal
} }
//IsLegalOption 判断选项是否为合法选项
func IsLegalOption(options []string, option string) bool { func IsLegalOption(options []string, option string) bool {
for i := 0; i < len(options); i++ { for i := 0; i < len(options); i++ {
if options[i] == option { if options[i] == option {
...@@ -832,6 +855,7 @@ func IsLegalOption(options []string, option string) bool { ...@@ -832,6 +855,7 @@ func IsLegalOption(options []string, option string) bool {
return false return false
} }
//ChangeStatus 修改游戏状态,同步更新历史记录
func (action *Action) ChangeStatus(game *pkt.GuessGame, destStatus int32) { func (action *Action) ChangeStatus(game *pkt.GuessGame, destStatus int32) {
if game.Status != destStatus { if game.Status != destStatus {
game.PreStatus = game.Status game.PreStatus = game.Status
...@@ -843,6 +867,7 @@ func (action *Action) ChangeStatus(game *pkt.GuessGame, destStatus int32) { ...@@ -843,6 +867,7 @@ func (action *Action) ChangeStatus(game *pkt.GuessGame, destStatus int32) {
return return
} }
//ChangeAllAddrIndex 状态更新时,更新下注记录的历史信息
func (action *Action) ChangeAllAddrIndex(game *pkt.GuessGame) { func (action *Action) ChangeAllAddrIndex(game *pkt.GuessGame) {
for i := 0; i < len(game.Plays) ; i++ { for i := 0; i < len(game.Plays) ; i++ {
player := game.Plays[i] player := game.Plays[i]
...@@ -851,6 +876,7 @@ func (action *Action) ChangeAllAddrIndex(game *pkt.GuessGame) { ...@@ -851,6 +876,7 @@ func (action *Action) ChangeAllAddrIndex(game *pkt.GuessGame) {
} }
} }
//RefreshStatusByTime 检测游戏是否过期,是否可以下注
func (action *Action) RefreshStatusByTime(game *pkt.GuessGame) (canBet bool) { func (action *Action) RefreshStatusByTime(game *pkt.GuessGame) (canBet bool) {
var mainHeight int64 var mainHeight int64
...@@ -895,6 +921,7 @@ func (action *Action) RefreshStatusByTime(game *pkt.GuessGame) (canBet bool) { ...@@ -895,6 +921,7 @@ func (action *Action) RefreshStatusByTime(game *pkt.GuessGame) (canBet bool) {
return canBet return canBet
} }
//CheckTime 检测游戏的过期设置。
func (action *Action) CheckTime(start *pkt.GuessGameStart) bool { func (action *Action) CheckTime(start *pkt.GuessGameStart) bool {
if start.MaxBetHeight == 0 && start.ExpireHeight == 0 { if start.MaxBetHeight == 0 && start.ExpireHeight == 0 {
//如果上述字段都不携带,则认为完全由admin的指令驱动。 //如果上述字段都不携带,则认为完全由admin的指令驱动。
......
...@@ -9,10 +9,12 @@ import ( ...@@ -9,10 +9,12 @@ import (
pkt "github.com/33cn/plugin/plugin/dapp/guess/types" pkt "github.com/33cn/plugin/plugin/dapp/guess/types"
) )
//Query_QueryGamesByIds method
func (g *Guess) Query_QueryGamesByIds(in *pkt.QueryGuessGameInfos) (types.Message, error) { func (g *Guess) Query_QueryGamesByIds(in *pkt.QueryGuessGameInfos) (types.Message, error) {
return Infos(g.GetStateDB(), in) return Infos(g.GetStateDB(), in)
} }
//Query_QueryGameById method
func (g *Guess) Query_QueryGameById(in *pkt.QueryGuessGameInfo) (types.Message, error) { func (g *Guess) Query_QueryGameById(in *pkt.QueryGuessGameInfo) (types.Message, error) {
game, err := readGame(g.GetStateDB(), in.GetGameId()) game, err := readGame(g.GetStateDB(), in.GetGameId())
if err != nil { if err != nil {
...@@ -21,6 +23,7 @@ func (g *Guess) Query_QueryGameById(in *pkt.QueryGuessGameInfo) (types.Message, ...@@ -21,6 +23,7 @@ func (g *Guess) Query_QueryGameById(in *pkt.QueryGuessGameInfo) (types.Message,
return &pkt.ReplyGuessGameInfo{Game: game}, nil return &pkt.ReplyGuessGameInfo{Game: game}, nil
} }
//Query_QueryGamesByAddr method
func (g *Guess) Query_QueryGamesByAddr(in *pkt.QueryGuessGameInfo) (types.Message, error) { func (g *Guess) Query_QueryGamesByAddr(in *pkt.QueryGuessGameInfo) (types.Message, error) {
records, err := getGameListByAddr(g.GetLocalDB(), in.Addr, in.Index) records, err := getGameListByAddr(g.GetLocalDB(), in.Addr, in.Index)
if err != nil { if err != nil {
...@@ -30,6 +33,7 @@ func (g *Guess) Query_QueryGamesByAddr(in *pkt.QueryGuessGameInfo) (types.Messag ...@@ -30,6 +33,7 @@ func (g *Guess) Query_QueryGamesByAddr(in *pkt.QueryGuessGameInfo) (types.Messag
return records, nil return records, nil
} }
//Query_QueryGamesByStatus method
func (g *Guess) Query_QueryGamesByStatus(in *pkt.QueryGuessGameInfo) (types.Message, error) { func (g *Guess) Query_QueryGamesByStatus(in *pkt.QueryGuessGameInfo) (types.Message, error) {
records, err := getGameListByStatus(g.GetLocalDB(), in.Status, in.Index) records, err := getGameListByStatus(g.GetLocalDB(), in.Status, in.Index)
if err != nil { if err != nil {
...@@ -39,6 +43,7 @@ func (g *Guess) Query_QueryGamesByStatus(in *pkt.QueryGuessGameInfo) (types.Mess ...@@ -39,6 +43,7 @@ func (g *Guess) Query_QueryGamesByStatus(in *pkt.QueryGuessGameInfo) (types.Mess
return records, nil return records, nil
} }
//Query_QueryGamesByAdminAddr method
func (g *Guess) Query_QueryGamesByAdminAddr(in *pkt.QueryGuessGameInfo) (types.Message, error) { func (g *Guess) Query_QueryGamesByAdminAddr(in *pkt.QueryGuessGameInfo) (types.Message, error) {
records, err := getGameListByAdminAddr(g.GetLocalDB(), in.AdminAddr, in.Index) records, err := getGameListByAdminAddr(g.GetLocalDB(), in.AdminAddr, in.Index)
if err != nil { if err != nil {
...@@ -48,6 +53,7 @@ func (g *Guess) Query_QueryGamesByAdminAddr(in *pkt.QueryGuessGameInfo) (types.M ...@@ -48,6 +53,7 @@ func (g *Guess) Query_QueryGamesByAdminAddr(in *pkt.QueryGuessGameInfo) (types.M
return records, nil return records, nil
} }
//Query_QueryGamesByAddrStatus method
func (g *Guess) Query_QueryGamesByAddrStatus(in *pkt.QueryGuessGameInfo) (types.Message, error) { func (g *Guess) Query_QueryGamesByAddrStatus(in *pkt.QueryGuessGameInfo) (types.Message, error) {
records, err := getGameListByAddrStatus(g.GetLocalDB(), in.Addr, in.Status, in.Index) records, err := getGameListByAddrStatus(g.GetLocalDB(), in.Addr, in.Status, in.Index)
if err != nil { if err != nil {
...@@ -57,6 +63,7 @@ func (g *Guess) Query_QueryGamesByAddrStatus(in *pkt.QueryGuessGameInfo) (types. ...@@ -57,6 +63,7 @@ func (g *Guess) Query_QueryGamesByAddrStatus(in *pkt.QueryGuessGameInfo) (types.
return records, nil return records, nil
} }
//Query_QueryGamesByAdminStatus method
func (g *Guess) Query_QueryGamesByAdminStatus(in *pkt.QueryGuessGameInfo) (types.Message, error) { func (g *Guess) Query_QueryGamesByAdminStatus(in *pkt.QueryGuessGameInfo) (types.Message, error) {
records, err := getGameListByAdminStatus(g.GetLocalDB(), in.AdminAddr, in.Status, in.Index) records, err := getGameListByAdminStatus(g.GetLocalDB(), in.AdminAddr, in.Status, in.Index)
if err != nil { if err != nil {
...@@ -66,6 +73,7 @@ func (g *Guess) Query_QueryGamesByAdminStatus(in *pkt.QueryGuessGameInfo) (types ...@@ -66,6 +73,7 @@ func (g *Guess) Query_QueryGamesByAdminStatus(in *pkt.QueryGuessGameInfo) (types
return records, nil return records, nil
} }
//Query_QueryGamesByCategoryStatus method
func (g *Guess) Query_QueryGamesByCategoryStatus(in *pkt.QueryGuessGameInfo) (types.Message, error) { func (g *Guess) Query_QueryGamesByCategoryStatus(in *pkt.QueryGuessGameInfo) (types.Message, error) {
records, err := getGameListByCategoryStatus(g.GetLocalDB(), in.Category, in.Status, in.Index) records, err := getGameListByCategoryStatus(g.GetLocalDB(), in.Category, in.Status, in.Index)
if err != nil { if err != nil {
......
...@@ -4,7 +4,7 @@ import "transaction.proto"; ...@@ -4,7 +4,7 @@ import "transaction.proto";
package types; package types;
//竞猜游戏内容 //GuessGame 竞猜游戏详情
message GuessGame { message GuessGame {
string gameId = 1; //游戏ID string gameId = 1; //游戏ID
int32 status = 2; //游戏的状态:创建->投注->截止投注->开奖 int32 status = 2; //游戏的状态:创建->投注->截止投注->开奖
...@@ -33,11 +33,13 @@ message GuessGame { ...@@ -33,11 +33,13 @@ message GuessGame {
bool drivenByAdmin = 25; bool drivenByAdmin = 25;
} }
//GuessPlayer 竞猜玩家信息
message GuessPlayer { message GuessPlayer {
string addr = 1; string addr = 1;
GuessBet bet = 2; GuessBet bet = 2;
} }
//GuessBet 竞猜下注信息
message GuessBet { message GuessBet {
string option = 1; string option = 1;
int64 betsNumber = 2; int64 betsNumber = 2;
...@@ -47,19 +49,21 @@ message GuessBet { ...@@ -47,19 +49,21 @@ message GuessBet {
int64 preIndex = 6; int64 preIndex = 6;
} }
//GuessBetStat 竞猜下注统计信息
message GuessBetStat { message GuessBetStat {
int64 totalBetTimes = 1; int64 totalBetTimes = 1;
int64 totalBetsNumber = 2; int64 totalBetsNumber = 2;
repeated GuessBetStatItem items = 3; repeated GuessBetStatItem items = 3;
} }
//GuessBetStat 竞猜下注子选项统计信息
message GuessBetStatItem { message GuessBetStatItem {
string option = 1; string option = 1;
int64 betsNumber = 2; int64 betsNumber = 2;
int64 betsTimes = 3; int64 betsTimes = 3;
} }
//游戏状态 //GuessGameAction 竞猜游戏动作
message GuessGameAction { message GuessGameAction {
oneof value { oneof value {
GuessGameStart start = 1; GuessGameStart start = 1;
...@@ -72,7 +76,7 @@ message GuessGameAction { ...@@ -72,7 +76,7 @@ message GuessGameAction {
int32 ty = 7; int32 ty = 7;
} }
//游戏启动 //GuessGameStart 游戏创建
message GuessGameStart{ message GuessGameStart{
string topic = 1; string topic = 1;
string options = 2; string options = 2;
...@@ -88,36 +92,36 @@ message GuessGameStart{ ...@@ -88,36 +92,36 @@ message GuessGameStart{
bool drivenByAdmin = 12; bool drivenByAdmin = 12;
} }
//参与游戏下注 //GuessGameBet 参与游戏下注
message GuessGameBet{ message GuessGameBet{
string gameId = 1; string gameId = 1;
string option = 2; string option = 2;
int64 betsNum = 3; int64 betsNum = 3;
} }
//游戏停止下注 //GuessGameStopBet 游戏停止下注
message GuessGameStopBet{ message GuessGameStopBet{
string gameId = 1; string gameId = 1;
} }
//游戏异常终止,退还下注 //GuessGameAbort 游戏异常终止,退还下注
message GuessGameAbort{ message GuessGameAbort{
string gameId = 1; string gameId = 1;
} }
//游戏结果揭晓 //GuessGamePublish 游戏结果揭晓
message GuessGamePublish{ message GuessGamePublish{
string gameId = 1; string gameId = 1;
string result = 2; string result = 2;
} }
//查询游戏结果 //GuessGameQuery 查询游戏结果
message GuessGameQuery{ message GuessGameQuery{
string gameId = 1; string gameId = 1;
uint32 ty = 2; uint32 ty = 2;
} }
//QueryGuessGameInfo 游戏信息查询消息
message QueryGuessGameInfo { message QueryGuessGameInfo {
string gameId = 1; string gameId = 1;
string addr = 2; string addr = 2;
...@@ -127,18 +131,22 @@ message QueryGuessGameInfo { ...@@ -127,18 +131,22 @@ message QueryGuessGameInfo {
string category = 6; string category = 6;
} }
//ReplyGuessGameInfo 游戏信息查询响应消息
message ReplyGuessGameInfo { message ReplyGuessGameInfo {
GuessGame game = 1; GuessGame game = 1;
} }
//QueryGuessGameInfos 游戏信息列表查询消息
message QueryGuessGameInfos { message QueryGuessGameInfos {
repeated string gameIds = 1; repeated string gameIds = 1;
} }
//ReplyGuessGameInfos 游戏信息列表查询响应消息
message ReplyGuessGameInfos { message ReplyGuessGameInfos {
repeated GuessGame games = 1; repeated GuessGame games = 1;
} }
//ReceiptGuessGame 竞猜游戏收据信息
message ReceiptGuessGame { message ReceiptGuessGame {
string gameId = 1; string gameId = 1;
int32 preStatus = 2; int32 preStatus = 2;
...@@ -151,6 +159,7 @@ message ReceiptGuessGame { ...@@ -151,6 +159,7 @@ message ReceiptGuessGame {
bool statusChange = 9; bool statusChange = 9;
} }
//GuessStartTxReq 构造start交易的请求
message GuessStartTxReq { message GuessStartTxReq {
string topic = 1; string topic = 1;
string options = 2; string options = 2;
...@@ -167,6 +176,7 @@ message GuessStartTxReq { ...@@ -167,6 +176,7 @@ message GuessStartTxReq {
int64 fee = 13; int64 fee = 13;
} }
//GuessBetTxReq 构造bet交易的请求
message GuessBetTxReq { message GuessBetTxReq {
string gameId = 1; string gameId = 1;
string option = 2; string option = 2;
...@@ -174,40 +184,39 @@ message GuessBetTxReq { ...@@ -174,40 +184,39 @@ message GuessBetTxReq {
int64 fee = 4; int64 fee = 4;
} }
//GuessStopBetTxReq 构造stopBet交易的请求
message GuessStopBetTxReq { message GuessStopBetTxReq {
string gameId = 1; string gameId = 1;
int64 fee = 2; int64 fee = 2;
} }
//GuessAbortTxReq 构造abort交易的请求
message GuessAbortTxReq { message GuessAbortTxReq {
string gameId = 1; string gameId = 1;
int64 fee = 2; int64 fee = 2;
} }
//GuessPublishTxReq 构造publish交易的请求
message GuessPublishTxReq { message GuessPublishTxReq {
string gameId = 1; string gameId = 1;
string result = 2; string result = 2;
int64 fee = 3; int64 fee = 3;
} }
// 索引value值 // GuessGameRecord game信息查询记录
message GuessGameRecord { message GuessGameRecord {
string gameId = 1; string gameId = 1;
int32 status = 2; int32 status = 2;
int64 index = 3; int64 index = 3;
} }
message GuessGameIndexRecord { // GuessGameRecords game信息查询记录集
string gameId = 1;
int64 index = 2;
}
message GuessGameRecords { message GuessGameRecords {
repeated GuessGameRecord records = 1; repeated GuessGameRecord records = 1;
} }
// guess 对外提供服务的接口 // service guess 为guess 对外提供服务的接口
service guess { service guess {
//游戏开始 //游戏开始
rpc GuessStart(GuessGameStart) returns (UnsignTx) {} rpc GuessStart(GuessGameStart) returns (UnsignTx) {}
......
...@@ -12,6 +12,7 @@ import ( ...@@ -12,6 +12,7 @@ import (
pb "github.com/33cn/plugin/plugin/dapp/guess/types" pb "github.com/33cn/plugin/plugin/dapp/guess/types"
) )
//GuessStartTx 构造start原始交易
func (c *Jrpc) GuessStartTx(parm *pb.GuessStartTxReq, result *interface{}) error { func (c *Jrpc) GuessStartTx(parm *pb.GuessStartTxReq, result *interface{}) error {
if parm == nil { if parm == nil {
return types.ErrInvalidParam return types.ErrInvalidParam
...@@ -25,6 +26,7 @@ func (c *Jrpc) GuessStartTx(parm *pb.GuessStartTxReq, result *interface{}) error ...@@ -25,6 +26,7 @@ func (c *Jrpc) GuessStartTx(parm *pb.GuessStartTxReq, result *interface{}) error
return nil return nil
} }
//GuessBetTx 构造bet原始交易
func (c *Jrpc) GuessBetTx(parm *pb.GuessBetTxReq, result *interface{}) error { func (c *Jrpc) GuessBetTx(parm *pb.GuessBetTxReq, result *interface{}) error {
if parm == nil { if parm == nil {
return types.ErrInvalidParam return types.ErrInvalidParam
...@@ -39,6 +41,7 @@ func (c *Jrpc) GuessBetTx(parm *pb.GuessBetTxReq, result *interface{}) error { ...@@ -39,6 +41,7 @@ func (c *Jrpc) GuessBetTx(parm *pb.GuessBetTxReq, result *interface{}) error {
return nil return nil
} }
//GuessStopBetTx 构造stopBet原始交易
func (c *Jrpc) GuessStopBetTx(parm *pb.GuessStopBetTxReq, result *interface{}) error { func (c *Jrpc) GuessStopBetTx(parm *pb.GuessStopBetTxReq, result *interface{}) error {
if parm == nil { if parm == nil {
return types.ErrInvalidParam return types.ErrInvalidParam
...@@ -53,6 +56,7 @@ func (c *Jrpc) GuessStopBetTx(parm *pb.GuessStopBetTxReq, result *interface{}) e ...@@ -53,6 +56,7 @@ func (c *Jrpc) GuessStopBetTx(parm *pb.GuessStopBetTxReq, result *interface{}) e
return nil return nil
} }
//GuessAbortTx 构造abort原始交易
func (c *Jrpc) GuessAbortTx(parm *pb.GuessAbortTxReq, result *interface{}) error { func (c *Jrpc) GuessAbortTx(parm *pb.GuessAbortTxReq, result *interface{}) error {
if parm == nil { if parm == nil {
return types.ErrInvalidParam return types.ErrInvalidParam
...@@ -67,6 +71,7 @@ func (c *Jrpc) GuessAbortTx(parm *pb.GuessAbortTxReq, result *interface{}) error ...@@ -67,6 +71,7 @@ func (c *Jrpc) GuessAbortTx(parm *pb.GuessAbortTxReq, result *interface{}) error
return nil return nil
} }
//GuessPublishTx 构造publish原始交易
func (c *Jrpc) GuessPublishTx(parm *pb.GuessPublishTxReq, result *interface{}) error { func (c *Jrpc) GuessPublishTx(parm *pb.GuessPublishTxReq, result *interface{}) error {
if parm == nil { if parm == nil {
return types.ErrInvalidParam return types.ErrInvalidParam
......
...@@ -11,6 +11,7 @@ import ( ...@@ -11,6 +11,7 @@ import (
pb "github.com/33cn/plugin/plugin/dapp/guess/types" pb "github.com/33cn/plugin/plugin/dapp/guess/types"
) )
//构造start原始交易
func (c *channelClient) GuessStart(ctx context.Context, parm *pb.GuessStartTxReq) (*types.UnsignTx, error) { func (c *channelClient) GuessStart(ctx context.Context, parm *pb.GuessStartTxReq) (*types.UnsignTx, error) {
v := &pb.GuessGameStart{ v := &pb.GuessGameStart{
Topic: parm.Topic, Topic: parm.Topic,
...@@ -28,7 +29,7 @@ func (c *channelClient) GuessStart(ctx context.Context, parm *pb.GuessStartTxReq ...@@ -28,7 +29,7 @@ func (c *channelClient) GuessStart(ctx context.Context, parm *pb.GuessStartTxReq
val := &pb.GuessGameAction{ val := &pb.GuessGameAction{
Ty: pb.GuessGameActionStart, Ty: pb.GuessGameActionStart,
Value: &pb.GuessGameAction_Start{v}, Value: &pb.GuessGameAction_Start{Start: v},
} }
name := types.ExecName(pb.GuessX) name := types.ExecName(pb.GuessX)
...@@ -47,6 +48,7 @@ func (c *channelClient) GuessStart(ctx context.Context, parm *pb.GuessStartTxReq ...@@ -47,6 +48,7 @@ func (c *channelClient) GuessStart(ctx context.Context, parm *pb.GuessStartTxReq
return &types.UnsignTx{Data: data}, nil return &types.UnsignTx{Data: data}, nil
} }
//构造bet原始交易
func (c *channelClient) GuessBet(ctx context.Context, parm *pb.GuessBetTxReq) (*types.UnsignTx, error) { func (c *channelClient) GuessBet(ctx context.Context, parm *pb.GuessBetTxReq) (*types.UnsignTx, error) {
v := &pb.GuessGameBet{ v := &pb.GuessGameBet{
GameId: parm.GameId, GameId: parm.GameId,
...@@ -56,7 +58,7 @@ func (c *channelClient) GuessBet(ctx context.Context, parm *pb.GuessBetTxReq) (* ...@@ -56,7 +58,7 @@ func (c *channelClient) GuessBet(ctx context.Context, parm *pb.GuessBetTxReq) (*
val := &pb.GuessGameAction{ val := &pb.GuessGameAction{
Ty: pb.GuessGameActionBet, Ty: pb.GuessGameActionBet,
Value: &pb.GuessGameAction_Bet{v}, Value: &pb.GuessGameAction_Bet{Bet: v},
} }
name := types.ExecName(pb.GuessX) name := types.ExecName(pb.GuessX)
...@@ -75,6 +77,7 @@ func (c *channelClient) GuessBet(ctx context.Context, parm *pb.GuessBetTxReq) (* ...@@ -75,6 +77,7 @@ func (c *channelClient) GuessBet(ctx context.Context, parm *pb.GuessBetTxReq) (*
return &types.UnsignTx{Data: data}, nil return &types.UnsignTx{Data: data}, nil
} }
//构造stopBet原始交易
func (c *channelClient) GuessStopBet(ctx context.Context, parm *pb.GuessStopBetTxReq) (*types.UnsignTx, error) { func (c *channelClient) GuessStopBet(ctx context.Context, parm *pb.GuessStopBetTxReq) (*types.UnsignTx, error) {
v := &pb.GuessGameStopBet{ v := &pb.GuessGameStopBet{
GameId: parm.GameId, GameId: parm.GameId,
...@@ -82,7 +85,7 @@ func (c *channelClient) GuessStopBet(ctx context.Context, parm *pb.GuessStopBetT ...@@ -82,7 +85,7 @@ func (c *channelClient) GuessStopBet(ctx context.Context, parm *pb.GuessStopBetT
val := &pb.GuessGameAction{ val := &pb.GuessGameAction{
Ty: pb.GuessGameActionStopBet, Ty: pb.GuessGameActionStopBet,
Value: &pb.GuessGameAction_StopBet{v}, Value: &pb.GuessGameAction_StopBet{StopBet: v},
} }
name := types.ExecName(pb.GuessX) name := types.ExecName(pb.GuessX)
...@@ -101,6 +104,7 @@ func (c *channelClient) GuessStopBet(ctx context.Context, parm *pb.GuessStopBetT ...@@ -101,6 +104,7 @@ func (c *channelClient) GuessStopBet(ctx context.Context, parm *pb.GuessStopBetT
return &types.UnsignTx{Data: data}, nil return &types.UnsignTx{Data: data}, nil
} }
//构造abort原始交易
func (c *channelClient) GuessAbort(ctx context.Context, parm *pb.GuessAbortTxReq) (*types.UnsignTx, error) { func (c *channelClient) GuessAbort(ctx context.Context, parm *pb.GuessAbortTxReq) (*types.UnsignTx, error) {
v := &pb.GuessGameAbort{ v := &pb.GuessGameAbort{
GameId: parm.GameId, GameId: parm.GameId,
...@@ -108,7 +112,7 @@ func (c *channelClient) GuessAbort(ctx context.Context, parm *pb.GuessAbortTxReq ...@@ -108,7 +112,7 @@ func (c *channelClient) GuessAbort(ctx context.Context, parm *pb.GuessAbortTxReq
val := &pb.GuessGameAction{ val := &pb.GuessGameAction{
Ty: pb.GuessGameActionAbort, Ty: pb.GuessGameActionAbort,
Value: &pb.GuessGameAction_Abort{v}, Value: &pb.GuessGameAction_Abort{Abort: v},
} }
name := types.ExecName(pb.GuessX) name := types.ExecName(pb.GuessX)
tx := &types.Transaction{ tx := &types.Transaction{
...@@ -126,6 +130,7 @@ func (c *channelClient) GuessAbort(ctx context.Context, parm *pb.GuessAbortTxReq ...@@ -126,6 +130,7 @@ func (c *channelClient) GuessAbort(ctx context.Context, parm *pb.GuessAbortTxReq
return &types.UnsignTx{Data: data}, nil return &types.UnsignTx{Data: data}, nil
} }
//构造publish原始交易
func (c *channelClient) GuessPublish(ctx context.Context, parm *pb.GuessPublishTxReq) (*types.UnsignTx, error) { func (c *channelClient) GuessPublish(ctx context.Context, parm *pb.GuessPublishTxReq) (*types.UnsignTx, error) {
v := &pb.GuessGamePublish{ v := &pb.GuessGamePublish{
GameId: parm.GameId, GameId: parm.GameId,
...@@ -134,7 +139,7 @@ func (c *channelClient) GuessPublish(ctx context.Context, parm *pb.GuessPublishT ...@@ -134,7 +139,7 @@ func (c *channelClient) GuessPublish(ctx context.Context, parm *pb.GuessPublishT
val := &pb.GuessGameAction{ val := &pb.GuessGameAction{
Ty: pb.GuessGameActionPublish, Ty: pb.GuessGameActionPublish,
Value: &pb.GuessGameAction_Publish{v}, Value: &pb.GuessGameAction_Publish{Publish: v},
} }
name := types.ExecName(pb.GuessX) name := types.ExecName(pb.GuessX)
...@@ -153,10 +158,11 @@ func (c *channelClient) GuessPublish(ctx context.Context, parm *pb.GuessPublishT ...@@ -153,10 +158,11 @@ func (c *channelClient) GuessPublish(ctx context.Context, parm *pb.GuessPublishT
return &types.UnsignTx{Data: data}, nil return &types.UnsignTx{Data: data}, nil
} }
//构造查询交易
func (c *channelClient) Show(ctx context.Context, head *pb.GuessGameQuery) (*types.UnsignTx, error) { func (c *channelClient) Show(ctx context.Context, head *pb.GuessGameQuery) (*types.UnsignTx, error) {
val := &pb.GuessGameAction{ val := &pb.GuessGameAction{
Ty: pb.GuessGameActionQuery, Ty: pb.GuessGameActionQuery,
Value: &pb.GuessGameAction_Query{head}, Value: &pb.GuessGameAction_Query{Query: head},
} }
tx, err := types.CreateFormatTx(pb.GuessX, types.Encode(val)) tx, err := types.CreateFormatTx(pb.GuessX, types.Encode(val))
if err != nil { if err != nil {
......
...@@ -8,10 +8,12 @@ import ( ...@@ -8,10 +8,12 @@ import (
"github.com/33cn/chain33/rpc/types" "github.com/33cn/chain33/rpc/types"
) )
//Jrpc struct
type Jrpc struct { type Jrpc struct {
cli *channelClient cli *channelClient
} }
//Grpc struct
type Grpc struct { type Grpc struct {
*channelClient *channelClient
} }
...@@ -20,6 +22,7 @@ type channelClient struct { ...@@ -20,6 +22,7 @@ type channelClient struct {
types.ChannelClient types.ChannelClient
} }
//Init method
func Init(name string, s types.RPCServer) { func Init(name string, s types.RPCServer) {
cli := &channelClient{} cli := &channelClient{}
grpc := &Grpc{channelClient: cli} grpc := &Grpc{channelClient: cli}
......
...@@ -26,6 +26,7 @@ const ( ...@@ -26,6 +26,7 @@ const (
GuessGameStatusTimeOut GuessGameStatusTimeOut
) )
//game log ty
const ( const (
TyLogGuessGameStart = 901 TyLogGuessGameStart = 901
TyLogGuessGameBet = 902 TyLogGuessGameBet = 902
...@@ -45,18 +46,28 @@ var ( ...@@ -45,18 +46,28 @@ var (
) )
const ( const (
//查询方法名 //FuncName_QueryGamesByIds func name
FuncName_QueryGamesByIds = "QueryGamesByIds" FuncName_QueryGamesByIds = "QueryGamesByIds"
//FuncName_QueryGameById func name
FuncName_QueryGameById = "QueryGameById" FuncName_QueryGameById = "QueryGameById"
//FuncName_QueryGameByAddr func name
FuncName_QueryGameByAddr = "QueryGamesByAddr" FuncName_QueryGameByAddr = "QueryGamesByAddr"
//FuncName_QueryGameByStatus func name
FuncName_QueryGameByStatus = "QueryGamesByStatus" FuncName_QueryGameByStatus = "QueryGamesByStatus"
//FuncName_QueryGameByAdminAddr func name
FuncName_QueryGameByAdminAddr = "QueryGamesByAdminAddr" FuncName_QueryGameByAdminAddr = "QueryGamesByAdminAddr"
//FuncName_QueryGameByAddrStatus func name
FuncName_QueryGameByAddrStatus = "QueryGamesByAddrStatus" FuncName_QueryGameByAddrStatus = "QueryGamesByAddrStatus"
//FuncName_QueryGameByAdminStatus func name
FuncName_QueryGameByAdminStatus = "QueryGamesByAdminStatus" FuncName_QueryGameByAdminStatus = "QueryGamesByAdminStatus"
//FuncName_QueryGameByCategoryStatus func name
FuncName_QueryGameByCategoryStatus="QueryGamesByCategoryStatus" FuncName_QueryGameByCategoryStatus="QueryGamesByCategoryStatus"
) )
const ( const (
//DevShareAddr default value
DevShareAddr = "1D6RFZNp2rh6QdbcZ1d7RWuBUz61We6SD7" DevShareAddr = "1D6RFZNp2rh6QdbcZ1d7RWuBUz61We6SD7"
//PlatformShareAddr default value
PlatformShareAddr = "1PHtChNt3UcfssR7v7trKSk3WJtAWjKjjX" PlatformShareAddr = "1PHtChNt3UcfssR7v7trKSk3WJtAWjKjjX"
) )
\ No newline at end of file
...@@ -10,4 +10,5 @@ import "errors" ...@@ -10,4 +10,5 @@ import "errors"
var ( var (
ErrNoPrivilege = errors.New("ErrNoPrivilege") ErrNoPrivilege = errors.New("ErrNoPrivilege")
ErrGuessStatus = errors.New("ErrGuessStatus") ErrGuessStatus = errors.New("ErrGuessStatus")
ErrOverBetsLimit = errors.New("ErrOverBetsLimit")
) )
...@@ -23,7 +23,7 @@ var _ = math.Inf ...@@ -23,7 +23,7 @@ var _ = math.Inf
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
//竞猜游戏内容 //GuessGame 竞猜游戏详情
type GuessGame struct { type GuessGame struct {
GameId string `protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"` GameId string `protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
Status int32 `protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"` Status int32 `protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"`
...@@ -255,6 +255,7 @@ func (m *GuessGame) GetDrivenByAdmin() bool { ...@@ -255,6 +255,7 @@ func (m *GuessGame) GetDrivenByAdmin() bool {
return false return false
} }
//GuessPlayer 竞猜玩家信息
type GuessPlayer struct { type GuessPlayer struct {
Addr string `protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"` Addr string `protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"`
Bet *GuessBet `protobuf:"bytes,2,opt,name=bet,proto3" json:"bet,omitempty"` Bet *GuessBet `protobuf:"bytes,2,opt,name=bet,proto3" json:"bet,omitempty"`
...@@ -302,6 +303,7 @@ func (m *GuessPlayer) GetBet() *GuessBet { ...@@ -302,6 +303,7 @@ func (m *GuessPlayer) GetBet() *GuessBet {
return nil return nil
} }
//GuessBet 竞猜下注信息
type GuessBet struct { type GuessBet struct {
Option string `protobuf:"bytes,1,opt,name=option,proto3" json:"option,omitempty"` Option string `protobuf:"bytes,1,opt,name=option,proto3" json:"option,omitempty"`
BetsNumber int64 `protobuf:"varint,2,opt,name=betsNumber,proto3" json:"betsNumber,omitempty"` BetsNumber int64 `protobuf:"varint,2,opt,name=betsNumber,proto3" json:"betsNumber,omitempty"`
...@@ -381,6 +383,7 @@ func (m *GuessBet) GetPreIndex() int64 { ...@@ -381,6 +383,7 @@ func (m *GuessBet) GetPreIndex() int64 {
return 0 return 0
} }
//GuessBetStat 竞猜下注统计信息
type GuessBetStat struct { type GuessBetStat struct {
TotalBetTimes int64 `protobuf:"varint,1,opt,name=totalBetTimes,proto3" json:"totalBetTimes,omitempty"` TotalBetTimes int64 `protobuf:"varint,1,opt,name=totalBetTimes,proto3" json:"totalBetTimes,omitempty"`
TotalBetsNumber int64 `protobuf:"varint,2,opt,name=totalBetsNumber,proto3" json:"totalBetsNumber,omitempty"` TotalBetsNumber int64 `protobuf:"varint,2,opt,name=totalBetsNumber,proto3" json:"totalBetsNumber,omitempty"`
...@@ -436,6 +439,7 @@ func (m *GuessBetStat) GetItems() []*GuessBetStatItem { ...@@ -436,6 +439,7 @@ func (m *GuessBetStat) GetItems() []*GuessBetStatItem {
return nil return nil
} }
//GuessBetStat 竞猜下注子选项统计信息
type GuessBetStatItem struct { type GuessBetStatItem struct {
Option string `protobuf:"bytes,1,opt,name=option,proto3" json:"option,omitempty"` Option string `protobuf:"bytes,1,opt,name=option,proto3" json:"option,omitempty"`
BetsNumber int64 `protobuf:"varint,2,opt,name=betsNumber,proto3" json:"betsNumber,omitempty"` BetsNumber int64 `protobuf:"varint,2,opt,name=betsNumber,proto3" json:"betsNumber,omitempty"`
...@@ -491,7 +495,7 @@ func (m *GuessBetStatItem) GetBetsTimes() int64 { ...@@ -491,7 +495,7 @@ func (m *GuessBetStatItem) GetBetsTimes() int64 {
return 0 return 0
} }
//游戏状态 //GuessGameAction 竞猜游戏动作
type GuessGameAction struct { type GuessGameAction struct {
// Types that are valid to be assigned to Value: // Types that are valid to be assigned to Value:
// *GuessGameAction_Start // *GuessGameAction_Start
...@@ -778,7 +782,7 @@ func _GuessGameAction_OneofSizer(msg proto.Message) (n int) { ...@@ -778,7 +782,7 @@ func _GuessGameAction_OneofSizer(msg proto.Message) (n int) {
return n return n
} }
//游戏启动 //GuessGameStart 游戏创建
type GuessGameStart struct { type GuessGameStart struct {
Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"` Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"`
Options string `protobuf:"bytes,2,opt,name=options,proto3" json:"options,omitempty"` Options string `protobuf:"bytes,2,opt,name=options,proto3" json:"options,omitempty"`
...@@ -906,7 +910,7 @@ func (m *GuessGameStart) GetDrivenByAdmin() bool { ...@@ -906,7 +910,7 @@ func (m *GuessGameStart) GetDrivenByAdmin() bool {
return false return false
} }
//参与游戏下注 //GuessGameBet 参与游戏下注
type GuessGameBet struct { type GuessGameBet struct {
GameId string `protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"` GameId string `protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
Option string `protobuf:"bytes,2,opt,name=option,proto3" json:"option,omitempty"` Option string `protobuf:"bytes,2,opt,name=option,proto3" json:"option,omitempty"`
...@@ -962,7 +966,7 @@ func (m *GuessGameBet) GetBetsNum() int64 { ...@@ -962,7 +966,7 @@ func (m *GuessGameBet) GetBetsNum() int64 {
return 0 return 0
} }
//游戏停止下注 //GuessGameStopBet 游戏停止下注
type GuessGameStopBet struct { type GuessGameStopBet struct {
GameId string `protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"` GameId string `protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
...@@ -1002,7 +1006,7 @@ func (m *GuessGameStopBet) GetGameId() string { ...@@ -1002,7 +1006,7 @@ func (m *GuessGameStopBet) GetGameId() string {
return "" return ""
} }
//游戏异常终止,退还下注 //GuessGameAbort 游戏异常终止,退还下注
type GuessGameAbort struct { type GuessGameAbort struct {
GameId string `protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"` GameId string `protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
...@@ -1042,7 +1046,7 @@ func (m *GuessGameAbort) GetGameId() string { ...@@ -1042,7 +1046,7 @@ func (m *GuessGameAbort) GetGameId() string {
return "" return ""
} }
//游戏结果揭晓 //GuessGamePublish 游戏结果揭晓
type GuessGamePublish struct { type GuessGamePublish struct {
GameId string `protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"` GameId string `protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
Result string `protobuf:"bytes,2,opt,name=result,proto3" json:"result,omitempty"` Result string `protobuf:"bytes,2,opt,name=result,proto3" json:"result,omitempty"`
...@@ -1090,7 +1094,7 @@ func (m *GuessGamePublish) GetResult() string { ...@@ -1090,7 +1094,7 @@ func (m *GuessGamePublish) GetResult() string {
return "" return ""
} }
//查询游戏结果 //GuessGameQuery 查询游戏结果
type GuessGameQuery struct { type GuessGameQuery struct {
GameId string `protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"` GameId string `protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
Ty uint32 `protobuf:"varint,2,opt,name=ty,proto3" json:"ty,omitempty"` Ty uint32 `protobuf:"varint,2,opt,name=ty,proto3" json:"ty,omitempty"`
...@@ -1138,6 +1142,7 @@ func (m *GuessGameQuery) GetTy() uint32 { ...@@ -1138,6 +1142,7 @@ func (m *GuessGameQuery) GetTy() uint32 {
return 0 return 0
} }
//QueryGuessGameInfo 游戏信息查询消息
type QueryGuessGameInfo struct { type QueryGuessGameInfo struct {
GameId string `protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"` GameId string `protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
Addr string `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"` Addr string `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"`
...@@ -1217,6 +1222,7 @@ func (m *QueryGuessGameInfo) GetCategory() string { ...@@ -1217,6 +1222,7 @@ func (m *QueryGuessGameInfo) GetCategory() string {
return "" return ""
} }
//ReplyGuessGameInfo 游戏信息查询响应消息
type ReplyGuessGameInfo struct { type ReplyGuessGameInfo struct {
Game *GuessGame `protobuf:"bytes,1,opt,name=game,proto3" json:"game,omitempty"` Game *GuessGame `protobuf:"bytes,1,opt,name=game,proto3" json:"game,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
...@@ -1256,6 +1262,7 @@ func (m *ReplyGuessGameInfo) GetGame() *GuessGame { ...@@ -1256,6 +1262,7 @@ func (m *ReplyGuessGameInfo) GetGame() *GuessGame {
return nil return nil
} }
//QueryGuessGameInfos 游戏信息列表查询消息
type QueryGuessGameInfos struct { type QueryGuessGameInfos struct {
GameIds []string `protobuf:"bytes,1,rep,name=gameIds,proto3" json:"gameIds,omitempty"` GameIds []string `protobuf:"bytes,1,rep,name=gameIds,proto3" json:"gameIds,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
...@@ -1295,6 +1302,7 @@ func (m *QueryGuessGameInfos) GetGameIds() []string { ...@@ -1295,6 +1302,7 @@ func (m *QueryGuessGameInfos) GetGameIds() []string {
return nil return nil
} }
//ReplyGuessGameInfos 游戏信息列表查询响应消息
type ReplyGuessGameInfos struct { type ReplyGuessGameInfos struct {
Games []*GuessGame `protobuf:"bytes,1,rep,name=games,proto3" json:"games,omitempty"` Games []*GuessGame `protobuf:"bytes,1,rep,name=games,proto3" json:"games,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
...@@ -1334,6 +1342,7 @@ func (m *ReplyGuessGameInfos) GetGames() []*GuessGame { ...@@ -1334,6 +1342,7 @@ func (m *ReplyGuessGameInfos) GetGames() []*GuessGame {
return nil return nil
} }
//ReceiptGuessGame 竞猜游戏收据信息
type ReceiptGuessGame struct { type ReceiptGuessGame struct {
GameId string `protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"` GameId string `protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
PreStatus int32 `protobuf:"varint,2,opt,name=preStatus,proto3" json:"preStatus,omitempty"` PreStatus int32 `protobuf:"varint,2,opt,name=preStatus,proto3" json:"preStatus,omitempty"`
...@@ -1437,6 +1446,7 @@ func (m *ReceiptGuessGame) GetStatusChange() bool { ...@@ -1437,6 +1446,7 @@ func (m *ReceiptGuessGame) GetStatusChange() bool {
return false return false
} }
//GuessStartTxReq 构造start交易的请求
type GuessStartTxReq struct { type GuessStartTxReq struct {
Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"` Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"`
Options string `protobuf:"bytes,2,opt,name=options,proto3" json:"options,omitempty"` Options string `protobuf:"bytes,2,opt,name=options,proto3" json:"options,omitempty"`
...@@ -1572,6 +1582,7 @@ func (m *GuessStartTxReq) GetFee() int64 { ...@@ -1572,6 +1582,7 @@ func (m *GuessStartTxReq) GetFee() int64 {
return 0 return 0
} }
//GuessBetTxReq 构造bet交易的请求
type GuessBetTxReq struct { type GuessBetTxReq struct {
GameId string `protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"` GameId string `protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
Option string `protobuf:"bytes,2,opt,name=option,proto3" json:"option,omitempty"` Option string `protobuf:"bytes,2,opt,name=option,proto3" json:"option,omitempty"`
...@@ -1635,6 +1646,7 @@ func (m *GuessBetTxReq) GetFee() int64 { ...@@ -1635,6 +1646,7 @@ func (m *GuessBetTxReq) GetFee() int64 {
return 0 return 0
} }
//GuessStopBetTxReq 构造stopBet交易的请求
type GuessStopBetTxReq struct { type GuessStopBetTxReq struct {
GameId string `protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"` GameId string `protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
Fee int64 `protobuf:"varint,2,opt,name=fee,proto3" json:"fee,omitempty"` Fee int64 `protobuf:"varint,2,opt,name=fee,proto3" json:"fee,omitempty"`
...@@ -1682,6 +1694,7 @@ func (m *GuessStopBetTxReq) GetFee() int64 { ...@@ -1682,6 +1694,7 @@ func (m *GuessStopBetTxReq) GetFee() int64 {
return 0 return 0
} }
//GuessAbortTxReq 构造abort交易的请求
type GuessAbortTxReq struct { type GuessAbortTxReq struct {
GameId string `protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"` GameId string `protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
Fee int64 `protobuf:"varint,2,opt,name=fee,proto3" json:"fee,omitempty"` Fee int64 `protobuf:"varint,2,opt,name=fee,proto3" json:"fee,omitempty"`
...@@ -1729,6 +1742,7 @@ func (m *GuessAbortTxReq) GetFee() int64 { ...@@ -1729,6 +1742,7 @@ func (m *GuessAbortTxReq) GetFee() int64 {
return 0 return 0
} }
//GuessPublishTxReq 构造publish交易的请求
type GuessPublishTxReq struct { type GuessPublishTxReq struct {
GameId string `protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"` GameId string `protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
Result string `protobuf:"bytes,2,opt,name=result,proto3" json:"result,omitempty"` Result string `protobuf:"bytes,2,opt,name=result,proto3" json:"result,omitempty"`
...@@ -1784,7 +1798,7 @@ func (m *GuessPublishTxReq) GetFee() int64 { ...@@ -1784,7 +1798,7 @@ func (m *GuessPublishTxReq) GetFee() int64 {
return 0 return 0
} }
// 索引value值 // GuessGameRecord game信息查询记录
type GuessGameRecord struct { type GuessGameRecord struct {
GameId string `protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"` GameId string `protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
Status int32 `protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"` Status int32 `protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"`
...@@ -1840,53 +1854,7 @@ func (m *GuessGameRecord) GetIndex() int64 { ...@@ -1840,53 +1854,7 @@ func (m *GuessGameRecord) GetIndex() int64 {
return 0 return 0
} }
type GuessGameIndexRecord struct { // GuessGameRecords game信息查询记录集
GameId string `protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
Index int64 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *GuessGameIndexRecord) Reset() { *m = GuessGameIndexRecord{} }
func (m *GuessGameIndexRecord) String() string { return proto.CompactTextString(m) }
func (*GuessGameIndexRecord) ProtoMessage() {}
func (*GuessGameIndexRecord) Descriptor() ([]byte, []int) {
return fileDescriptor_7574406c5d3430e8, []int{23}
}
func (m *GuessGameIndexRecord) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GuessGameIndexRecord.Unmarshal(m, b)
}
func (m *GuessGameIndexRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_GuessGameIndexRecord.Marshal(b, m, deterministic)
}
func (m *GuessGameIndexRecord) XXX_Merge(src proto.Message) {
xxx_messageInfo_GuessGameIndexRecord.Merge(m, src)
}
func (m *GuessGameIndexRecord) XXX_Size() int {
return xxx_messageInfo_GuessGameIndexRecord.Size(m)
}
func (m *GuessGameIndexRecord) XXX_DiscardUnknown() {
xxx_messageInfo_GuessGameIndexRecord.DiscardUnknown(m)
}
var xxx_messageInfo_GuessGameIndexRecord proto.InternalMessageInfo
func (m *GuessGameIndexRecord) GetGameId() string {
if m != nil {
return m.GameId
}
return ""
}
func (m *GuessGameIndexRecord) GetIndex() int64 {
if m != nil {
return m.Index
}
return 0
}
type GuessGameRecords struct { type GuessGameRecords struct {
Records []*GuessGameRecord `protobuf:"bytes,1,rep,name=records,proto3" json:"records,omitempty"` Records []*GuessGameRecord `protobuf:"bytes,1,rep,name=records,proto3" json:"records,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
...@@ -1898,7 +1866,7 @@ func (m *GuessGameRecords) Reset() { *m = GuessGameRecords{} } ...@@ -1898,7 +1866,7 @@ func (m *GuessGameRecords) Reset() { *m = GuessGameRecords{} }
func (m *GuessGameRecords) String() string { return proto.CompactTextString(m) } func (m *GuessGameRecords) String() string { return proto.CompactTextString(m) }
func (*GuessGameRecords) ProtoMessage() {} func (*GuessGameRecords) ProtoMessage() {}
func (*GuessGameRecords) Descriptor() ([]byte, []int) { func (*GuessGameRecords) Descriptor() ([]byte, []int) {
return fileDescriptor_7574406c5d3430e8, []int{24} return fileDescriptor_7574406c5d3430e8, []int{23}
} }
func (m *GuessGameRecords) XXX_Unmarshal(b []byte) error { func (m *GuessGameRecords) XXX_Unmarshal(b []byte) error {
...@@ -1950,94 +1918,92 @@ func init() { ...@@ -1950,94 +1918,92 @@ func init() {
proto.RegisterType((*GuessAbortTxReq)(nil), "types.GuessAbortTxReq") proto.RegisterType((*GuessAbortTxReq)(nil), "types.GuessAbortTxReq")
proto.RegisterType((*GuessPublishTxReq)(nil), "types.GuessPublishTxReq") proto.RegisterType((*GuessPublishTxReq)(nil), "types.GuessPublishTxReq")
proto.RegisterType((*GuessGameRecord)(nil), "types.GuessGameRecord") proto.RegisterType((*GuessGameRecord)(nil), "types.GuessGameRecord")
proto.RegisterType((*GuessGameIndexRecord)(nil), "types.GuessGameIndexRecord")
proto.RegisterType((*GuessGameRecords)(nil), "types.GuessGameRecords") proto.RegisterType((*GuessGameRecords)(nil), "types.GuessGameRecords")
} }
func init() { proto.RegisterFile("guess.proto", fileDescriptor_7574406c5d3430e8) } func init() { proto.RegisterFile("guess.proto", fileDescriptor_7574406c5d3430e8) }
var fileDescriptor_7574406c5d3430e8 = []byte{ var fileDescriptor_7574406c5d3430e8 = []byte{
// 1268 bytes of a gzipped FileDescriptorProto // 1255 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0xcd, 0x6e, 0xdb, 0x46, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0xcd, 0x6e, 0xdb, 0x46,
0x10, 0xb6, 0x48, 0x51, 0x3f, 0x23, 0xd9, 0x56, 0xd6, 0x89, 0xc3, 0x1a, 0x46, 0xa1, 0x12, 0x41, 0x10, 0xb6, 0x48, 0x51, 0x3f, 0x23, 0xf9, 0x27, 0xeb, 0xc4, 0x61, 0x0d, 0xa3, 0x50, 0x89, 0x20,
0x2a, 0x14, 0x88, 0x5b, 0x28, 0x40, 0x51, 0xa4, 0xc8, 0xc1, 0x6a, 0x90, 0xd8, 0x97, 0x36, 0xa5, 0x15, 0x0a, 0xc4, 0x2d, 0x14, 0xa0, 0x28, 0x52, 0xe4, 0x60, 0x35, 0x48, 0xec, 0x4b, 0x9b, 0xd2,
0x1d, 0xa4, 0x57, 0x4a, 0x5a, 0xcb, 0x04, 0x24, 0x92, 0x21, 0x57, 0x86, 0x74, 0xef, 0xb5, 0x4f, 0x0e, 0xd2, 0x2b, 0x25, 0xad, 0x25, 0x02, 0x12, 0xc9, 0x90, 0x2b, 0x43, 0xba, 0xf7, 0xda, 0xa7,
0xd1, 0x1e, 0x7a, 0x6b, 0x9f, 0xa3, 0x4f, 0x55, 0xcc, 0xec, 0x52, 0x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 0x53, 0xb5, 0xb1, 0x9b, 0xaa, 0xf5, 0x7e, 0x37, 0xc0, 0xa2, 0x9f, 0xd4, 0xec, 0x5b, 0x80, 0xac, 0x27, 0x59,
0xfe, 0xef, 0x06, 0x58, 0xf4, 0x61, 0xce, 0xbe, 0x05, 0xc8, 0x3a, 0x9b, 0x95, 0x6f, 0x91, 0x27, 0xf9, 0xfe, 0x77, 0x9a, 0x2e, 0xfd, 0x1f, 0x82, 0xc4, 0x1f, 0x07, 0x37, 0x0b, 0x67, 0x8f, 0xf5,
0xe9, 0xa7, 0xc3, 0x87, 0x20, 0xf1, 0x27, 0xc1, 0xf5, 0xc2, 0xd9, 0x63, 0x7d, 0xed, 0xb3, 0xa1, 0xb4, 0x85, 0xbf, 0x6c, 0x11, 0x2c, 0x3b, 0xf3, 0x4a, 0x0d, 0xe3, 0x74, 0x5c, 0x6e, 0xda, 0x09,
0x6c, 0x9d, 0x2c, 0x3b, 0xf3, 0x4a, 0x8d, 0xf4, 0x74, 0xe8, 0x6e, 0xda, 0x2c, 0xcb, 0xce, 0xa6, 0xcb, 0xce, 0xa6, 0x71, 0xca, 0xf1, 0x59, 0xbe, 0x1a, 0xde, 0xe7, 0x33, 0x1d, 0xa6, 0x9b, 0x76,
0x71, 0xca, 0x21, 0x5c, 0xbe, 0x60, 0xde, 0xe7, 0x33, 0x1d, 0xc9, 0x9b, 0x36, 0xcd, 0x92, 0xb3, 0xc4, 0x92, 0xb3, 0x83, 0x1a, 0xfd, 0xab, 0xf0, 0xf2, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf0,
0xc3, 0x1a, 0xfd, 0x37, 0xf1, 0xf2, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xaf, 0x4b, 0x73, 0xb4, 0x09, 0xae, 0xf2, 0x7e, 0x10, 0x00, 0x00,
0xc4, 0x10, 0x00, 0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
package types package types
//GuessGameStartTx struct
type GuessGameStartTx struct { type GuessGameStartTx struct {
Topic string `json:"topic,omitempty"` Topic string `json:"topic,omitempty"`
Options string `json:"options,omitempty"` Options string `json:"options,omitempty"`
...@@ -19,6 +20,7 @@ type GuessGameStartTx struct { ...@@ -19,6 +20,7 @@ type GuessGameStartTx struct {
Fee int64 `json:"fee,omitempty"` Fee int64 `json:"fee,omitempty"`
} }
//GuessGameBetTx struct
type GuessGameBetTx struct { type GuessGameBetTx struct {
GameId string `json:"gameId,omitempty"` GameId string `json:"gameId,omitempty"`
Option string `json:"option,omitempty"` Option string `json:"option,omitempty"`
...@@ -26,17 +28,20 @@ type GuessGameBetTx struct { ...@@ -26,17 +28,20 @@ type GuessGameBetTx struct {
Fee int64 `json:"fee,omitempty"` Fee int64 `json:"fee,omitempty"`
} }
//GuessGameStopBetTx struct
type GuessGameStopBetTx struct { type GuessGameStopBetTx struct {
GameId string `json:"gameId,omitempty"` GameId string `json:"gameId,omitempty"`
Fee int64 `json:"fee,omitempty"` Fee int64 `json:"fee,omitempty"`
} }
//GuessGamePublishTx struct
type GuessGamePublishTx struct { type GuessGamePublishTx struct {
GameId string `json:"gameId,omitempty"` GameId string `json:"gameId,omitempty"`
Result string `json:"result,omitempty"` Result string `json:"result,omitempty"`
Fee int64 `json:"fee,omitempty"` Fee int64 `json:"fee,omitempty"`
} }
//GuessGameAbortTx struct
type GuessGameAbortTx struct { type GuessGameAbortTx struct {
GameId string `json:"gameId,omitempty"` GameId string `json:"gameId,omitempty"`
Fee int64 `json:"fee,omitempty"` Fee int64 `json:"fee,omitempty"`
......
...@@ -24,21 +24,24 @@ func init() { ...@@ -24,21 +24,24 @@ func init() {
types.RegisterDappFork(GuessX, "Enable", 0) types.RegisterDappFork(GuessX, "Enable", 0)
} }
// exec // GuessType struct
type GuessType struct { type GuessType struct {
types.ExecTypeBase types.ExecTypeBase
} }
// NewType method
func NewType() *GuessType { func NewType() *GuessType {
c := &GuessType{} c := &GuessType{}
c.SetChild(c) c.SetChild(c)
return c return c
} }
// GetPayload method
func (t *GuessType) GetPayload() types.Message { func (t *GuessType) GetPayload() types.Message {
return &GuessGameAction{} return &GuessGameAction{}
} }
// GetTypeMap method
func (t *GuessType) GetTypeMap() map[string]int32 { func (t *GuessType) GetTypeMap() map[string]int32 {
return map[string]int32{ return map[string]int32{
"Start": GuessGameActionStart, "Start": GuessGameActionStart,
...@@ -50,14 +53,15 @@ func (t *GuessType) GetTypeMap() map[string]int32 { ...@@ -50,14 +53,15 @@ func (t *GuessType) GetTypeMap() map[string]int32 {
} }
} }
// GetLogMap method
func (t *GuessType) GetLogMap() map[int64]*types.LogInfo { func (t *GuessType) GetLogMap() map[int64]*types.LogInfo {
return map[int64]*types.LogInfo{ return map[int64]*types.LogInfo{
TyLogGuessGameStart: {reflect.TypeOf(ReceiptGuessGame{}), "TyLogGuessGameStart"}, TyLogGuessGameStart: { Ty: reflect.TypeOf(ReceiptGuessGame{}), Name: "TyLogGuessGameStart"},
TyLogGuessGameBet: {reflect.TypeOf(ReceiptGuessGame{}), "TyLogGuessGameBet"}, TyLogGuessGameBet: { Ty: reflect.TypeOf(ReceiptGuessGame{}), Name: "TyLogGuessGameBet"},
TyLogGuessGameStopBet: {reflect.TypeOf(ReceiptGuessGame{}), "TyLogGuessGameStopBet"}, TyLogGuessGameStopBet: { Ty: reflect.TypeOf(ReceiptGuessGame{}), Name: "TyLogGuessGameStopBet"},
TyLogGuessGameAbort: {reflect.TypeOf(ReceiptGuessGame{}), "TyLogGuessGameAbort"}, TyLogGuessGameAbort: { Ty: reflect.TypeOf(ReceiptGuessGame{}), Name: "TyLogGuessGameAbort"},
TyLogGuessGamePublish: {reflect.TypeOf(ReceiptGuessGame{}), "TyLogGuessGamePublish"}, TyLogGuessGamePublish: { Ty: reflect.TypeOf(ReceiptGuessGame{}), Name: "TyLogGuessGamePublish"},
TyLogGuessGameTimeout: {reflect.TypeOf(ReceiptGuessGame{}), "TyLogGuessGameTimeout"}, TyLogGuessGameTimeout: { Ty: reflect.TypeOf(ReceiptGuessGame{}), Name: "TyLogGuessGameTimeout"},
} }
} }
...@@ -105,12 +109,12 @@ func (t *GuessType) CreateTx(action string, message json.RawMessage) (*types.Tra ...@@ -105,12 +109,12 @@ func (t *GuessType) CreateTx(action string, message json.RawMessage) (*types.Tra
return nil, types.ErrInvalidParam return nil, types.ErrInvalidParam
} }
return CreateRawGuessAbortTx(&param) return CreateRawGuessAbortTx(&param)
} else {
return nil, types.ErrNotSupport
} }
return nil, types.ErrNotSupport
} }
// CreateRawLotteryCreateTx method // CreateRawGuessStartTx method
func CreateRawGuessStartTx(parm *GuessGameStartTx) (*types.Transaction, error) { func CreateRawGuessStartTx(parm *GuessGameStartTx) (*types.Transaction, error) {
if parm == nil { if parm == nil {
llog.Error("CreateRawGuessStartTx", "parm", parm) llog.Error("CreateRawGuessStartTx", "parm", parm)
......
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