Commit 03065e62 authored by 张振华's avatar 张振华

table refactor

parent bfcd1f05
......@@ -123,7 +123,7 @@ func Key(id string) (key []byte) {
return key
}
//Infos 根据游戏id列表查询多个游戏详情信息
//QueryGameInfos 根据游戏id列表查询多个游戏详情信息
func QueryGameInfos(kvdb db.KVDB, infos *gty.QueryGuessGameInfos) (types.Message, error) {
var games []*gty.GuessGame
gameTable := gty.NewGuessGameTable(kvdb)
......
......@@ -60,7 +60,7 @@ func (g *Guess) Query_QueryGamesByAddrStatus(in *gty.QueryGuessGameInfo) (types.
return nil, err
}
prefix := table.JoinKey([]byte(fmt.Sprintf("%s", in.Addr)), []byte(fmt.Sprintf("%2d", in.Status)))
prefix := table.JoinKey([]byte(in.Addr), []byte(fmt.Sprintf("%2d", in.Status)))
return QueryJoinTableData(tableJoin, "addr#status", prefix, in.PrimaryKey)
}
......
......@@ -61,7 +61,7 @@ func (tx *GuessUserRow) Get(key string) ([]byte, error) {
if key == "index" {
return []byte(fmt.Sprintf("%018d", tx.Index)), nil
} else if key == "addr" {
return []byte(fmt.Sprintf("%s", tx.Addr)), nil
return []byte(tx.Addr), nil
} else if key == "startindex" {
return []byte(fmt.Sprintf("%018d", tx.StartIndex)), nil
}
......@@ -115,7 +115,7 @@ func (tx *GuessGameRow) Get(key string) ([]byte, error) {
if key == "startindex" {
return []byte(fmt.Sprintf("%018d", tx.StartIndex)), nil
} else if key == "gameid" {
return []byte(fmt.Sprintf("%s", tx.GameID)), nil
return []byte(tx.GameID), nil
} else if key == "status" {
return []byte(fmt.Sprintf("%2d", tx.Status)), nil
} else if key == "admin" {
......
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