Commit 043707db authored by 张振华's avatar 张振华

guess

parent 374b034b
......@@ -58,8 +58,13 @@ func (g *Guess) GetDriverName() string {
return pkt.GuessX
}
/*
// GetPayloadValue GuessAction
func (g *Guess) GetPayloadValue() types.Message {
return &pkt.GuessGameAction{}
}*/
// CheckReceiptExecOk return true to check if receipt ty is ok
func (g *Guess) CheckReceiptExecOk() bool {
return true
}
......@@ -91,7 +91,8 @@ func (action *Action) CheckExecAccountBalance(fromAddr string, ToFrozen, ToActiv
}
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(id)...)
return key
}
......@@ -415,8 +416,7 @@ func (action *Action) GameStart(start *pkt.GuessGameStart) (*types.Receipt, erro
game.PreIndex = 0
game.Index = action.getIndex()
game.Status = pkt.GuessGameStatusStart
game.BetStat.TotalBetTimes = 0
game.BetStat.TotalBetsNumber = 0
game.BetStat = &pkt.GuessBetStat{TotalBetTimes:0, TotalBetsNumber:0}
for i := 0; i < len(options); i++ {
item := &pkt.GuessBetStatItem{Option: options[i], BetsNumber: 0, BetsTimes: 0}
game.BetStat.Items = append(game.BetStat.Items, item)
......
......@@ -21,7 +21,7 @@ func (g *Guess) Query_QueryGameById(in *pkt.QueryGuessGameInfo) (types.Message,
return &pkt.ReplyGuessGameInfo{Game: game}, nil
}
func (g *Guess) Query_QueryGameByAddr(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)
if err != nil {
return nil, err
......@@ -30,7 +30,7 @@ func (g *Guess) Query_QueryGameByAddr(in *pkt.QueryGuessGameInfo) (types.Message
return records, nil
}
func (g *Guess) Query_QueryGameByStatus(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)
if err != nil {
return nil, err
......@@ -39,7 +39,7 @@ func (g *Guess) Query_QueryGameByStatus(in *pkt.QueryGuessGameInfo) (types.Messa
return records, nil
}
func (g *Guess) Query_QueryGameByAdminAddr(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)
if err != nil {
return nil, err
......@@ -48,7 +48,7 @@ func (g *Guess) Query_QueryGameByAdminAddr(in *pkt.QueryGuessGameInfo) (types.Me
return records, nil
}
func (g *Guess) Query_QueryGameByAddrStatus(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)
if err != nil {
return nil, err
......@@ -57,7 +57,7 @@ func (g *Guess) Query_QueryGameByAddrStatus(in *pkt.QueryGuessGameInfo) (types.M
return records, nil
}
func (g *Guess) Query_QueryGameByAdminStatus(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)
if err != nil {
return nil, err
......@@ -66,7 +66,7 @@ func (g *Guess) Query_QueryGameByAdminStatus(in *pkt.QueryGuessGameInfo) (types.
return records, nil
}
func (g *Guess) Query_QueryGameByCategoryStatus(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)
if err != nil {
return nil, err
......
......@@ -72,7 +72,7 @@ message GuessGameAction {
GuessGamePublish publish = 5;
GuessGameQuery query = 6;
}
uint32 ty = 7;
int32 ty = 7;
}
//游戏启动
......
......@@ -525,7 +525,7 @@ type GuessGameAction struct {
// *GuessGameAction_Publish
// *GuessGameAction_Query
Value isGuessGameAction_Value `protobuf_oneof:"value"`
Ty uint32 `protobuf:"varint,7,opt,name=ty,proto3" json:"ty,omitempty"`
Ty int32 `protobuf:"varint,7,opt,name=ty,proto3" json:"ty,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
......@@ -645,7 +645,7 @@ func (m *GuessGameAction) GetQuery() *GuessGameQuery {
return nil
}
func (m *GuessGameAction) GetTy() uint32 {
func (m *GuessGameAction) GetTy() int32 {
if m != nil {
return m.Ty
}
......@@ -1965,7 +1965,7 @@ func init() {
func init() { proto.RegisterFile("guess.proto", fileDescriptor_7574406c5d3430e8) }
var fileDescriptor_7574406c5d3430e8 = []byte{
// 1284 bytes of a gzipped FileDescriptorProto
// 1286 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xcd, 0x8e, 0xe3, 0x44,
0x10, 0x9e, 0x38, 0x71, 0x7e, 0x2a, 0xc9, 0x4c, 0xa6, 0x67, 0x7f, 0xcc, 0x30, 0xa0, 0x60, 0xad,
0x96, 0x80, 0xb4, 0x03, 0xca, 0x4a, 0x08, 0xad, 0xc4, 0x61, 0xb2, 0xab, 0xdd, 0x99, 0x0b, 0x2c,
......@@ -2013,40 +2013,40 @@ var fileDescriptor_7574406c5d3430e8 = []byte{
0xee, 0x4c, 0xe6, 0xcb, 0x03, 0x27, 0xf1, 0xc4, 0x60, 0xdc, 0x61, 0x10, 0xc9, 0x37, 0x2e, 0x08,
0xe6, 0x02, 0x8d, 0x18, 0x0c, 0x79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
0x09, 0x11, 0x00, 0x00,
0xc6, 0x8f, 0x68, 0xc4, 0x33, 0xc8, 0x8b, 0x1d, 0x82, 0x21, 0x24, 0xb6, 0x9b, 0x8e, 0x21, 0x96,
0x83, 0x1a, 0x98, 0x77, 0xee, 0x74, 0xce, 0xed, 0x5f, 0x2b, 0x70, 0x98, 0xcd, 0x52, 0xca, 0x11,
0x25, 0x9d, 0x23, 0x34, 0x1e, 0x30, 0xb2, 0x3c, 0xa0, 0xb3, 0x47, 0x39, 0xc7, 0x1e, 0x59, 0x8e,
0xa8, 0xec, 0xe4, 0x08, 0x73, 0x2b, 0x47, 0x54, 0x0b, 0x39, 0xa2, 0xb6, 0x95, 0x23, 0x1a, 0xfb,
0x71, 0x04, 0xec, 0xc3, 0x11, 0xcd, 0x9d, 0x1c, 0xd1, 0xda, 0xcd, 0x11, 0xed, 0x3d, 0x38, 0xe2,
0x70, 0x1b, 0x47, 0x1c, 0x6d, 0xe5, 0x88, 0x4e, 0x01, 0x47, 0xac, 0x41, 0xe8, 0x71, 0x11, 0x84,
0xfe, 0xac, 0x00, 0x45, 0xb5, 0xc0, 0xb6, 0xc9, 0x45, 0x75, 0xb5, 0x91, 0xe9, 0x6a, 0x8b, 0x98,
0x00, 0x73, 0xa7, 0x7a, 0x36, 0x11, 0xed, 0x2f, 0x15, 0x36, 0x68, 0xfd, 0xb2, 0x69, 0x77, 0xbb,
0xa7, 0xd5, 0x23, 0x35, 0xca, 0x46, 0xcf, 0x81, 0xb6, 0xab, 0xea, 0x90, 0x6d, 0x31, 0x2b, 0xf6,
0x32, 0x74, 0xf6, 0xb2, 0xbf, 0xd5, 0x4e, 0xa3, 0x96, 0xd9, 0xb8, 0x83, 0xec, 0x20, 0x89, 0x55,
0x86, 0x58, 0x22, 0x55, 0x30, 0x5a, 0xb1, 0x5a, 0x7f, 0xe5, 0xdf, 0x04, 0x1b, 0x97, 0x27, 0x84,
0x64, 0x68, 0x84, 0x94, 0x8e, 0x80, 0xe5, 0xcc,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0xda, 0xc9, 0x3c, 0x25, 0x9f, 0xff, 0xbe, 0x70, 0xcc, 0xa0, 0x82, 0xf8, 0xab, 0xb0, 0x98, 0x7e,
0xdb, 0x5f, 0xa8, 0xaa, 0x22, 0x60, 0xdd, 0xba, 0xad, 0xfd, 0x12, 0x8e, 0xe5, 0x40, 0x2d, 0x91,
0x75, 0x67, 0x0c, 0x85, 0xf0, 0xfa, 0x5e, 0x9b, 0xd4, 0x1c, 0x3e, 0x0a, 0xa2, 0xf1, 0xbd, 0xbf,
0x87, 0x57, 0xfd, 0x55, 0xd6, 0xfa, 0xcb, 0x7e, 0x05, 0x0f, 0x34, 0x80, 0x19, 0xf3, 0xc5, 0x8e,
0xdd, 0x57, 0xbb, 0x18, 0xd9, 0x5d, 0x3a, 0xb9, 0xf0, 0x62, 0xf6, 0x35, 0xd4, 0x22, 0xf9, 0x53,
0x41, 0xd5, 0xa3, 0x35, 0xa8, 0x22, 0xb3, 0x93, 0xb8, 0xf5, 0xff, 0x2c, 0x81, 0x49, 0xff, 0x0c,
0xb0, 0x6f, 0x00, 0xd2, 0xa6, 0x65, 0xc5, 0x43, 0xe8, 0x69, 0xf2, 0xe5, 0xf1, 0x93, 0x1f, 0x7b,
0x13, 0xff, 0xdd, 0xc2, 0x3e, 0x60, 0x7d, 0xed, 0xab, 0xa3, 0x68, 0x1a, 0x2d, 0x5a, 0x93, 0x9c,
0x25, 0x39, 0xb2, 0x78, 0xc6, 0x2c, 0x5a, 0xf7, 0x42, 0xb1, 0x7c, 0xc2, 0x98, 0x9b, 0x86, 0xcd,
0x82, 0xb5, 0xc3, 0x2a, 0xfd, 0xc1, 0xf1, 0xfc, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x42, 0x2c,
0x06, 0x12, 0x09, 0x11, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
......
......@@ -139,6 +139,7 @@ func CreateRawGuessStartTx(parm *GuessGameStartTx) (*types.Transaction, error) {
Ty: GuessGameActionStart,
Value: &GuessGameAction_Start{Start: v},
}
llog.Info("CreateRawGuessStartTx", "Ty", val.Ty, "GuessGameActionStart", GuessGameActionStart)
name := types.ExecName(GuessX)
tx := &types.Transaction{
Execer: []byte(types.ExecName(GuessX)),
......
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