110 lines
4.5 KiB
Go
110 lines
4.5 KiB
Go
package proto
|
||
|
||
/*
|
||
CREATE TABLE samba.player_game_record
|
||
(
|
||
`uid` Int64,
|
||
`game_no` String,
|
||
`room_type` Int32,
|
||
`start_time` DateTime,
|
||
`end_time` DateTime,
|
||
`take_coin` Int64,
|
||
`play_coin` Int64,
|
||
`favorite` int
|
||
)
|
||
ENGINE = MergeTree
|
||
PARTITION BY toYYYYMM(start_time)
|
||
ORDER BY intHash32(uid)
|
||
*/
|
||
|
||
/*
|
||
ALTER TABLE player_game_record ADD COLUMN club_id Int32 DEFAULT 0 AFTER room_type;
|
||
ALTER TABLE player_game_record ADD COLUMN start_time_i Int32 DEFAULT 0 AFTER start_time;
|
||
ALTER TABLE player_game_record ADD COLUMN end_time_i Int32 DEFAULT 0 AFTER end_time;
|
||
ALTER TABLE player_game_record ADD COLUMN blind Int64 DEFAULT 0 AFTER end_time_i;
|
||
ALTER TABLE player_game_record ADD COLUMN play_type Int32 DEFAULT 0 AFTER blind;
|
||
ALTER TABLE player_game_record ADD COLUMN room_id Int32 DEFAULT 0 AFTER play_type;
|
||
ALTER TABLE player_game_record ADD COLUMN max_game_num Int32 DEFAULT 0 AFTER room_id;
|
||
ALTER TABLE player_game_record ADD COLUMN game_num Int32 DEFAULT 0 AFTER max_game_num;
|
||
ALTER TABLE player_game_record ADD COLUMN status Int32 DEFAULT 0 AFTER game_num; // 房间状态:正常,玩家解散,管理解散,系统解散
|
||
ALTER TABLE player_game_record ADD COLUMN player_infos String AFTER status;
|
||
alter table player_game_record add column `members` UInt32 DEFAULT 0 COMMENT '人数';
|
||
*/
|
||
|
||
type GameRecordPlayerInfo struct {
|
||
UId int64 `json:"uid"` // 玩家id
|
||
Disband int `json:"disband"` // 解散状态 0:不同意 1:同意 2:发起
|
||
Win int64 `json:"win"` // 净胜分
|
||
}
|
||
|
||
// PlayerGameRecord 玩家游戏记录
|
||
type PlayerGameRecord struct {
|
||
UId int64 `json:"uid"` // 玩家id
|
||
GameNo string `json:"game_no"` // 本局游戏唯一id
|
||
RoomType int `json:"room_type"` // 配置表中的房间id
|
||
StartTime int64 `json:"start_time"` // 游戏开始时间
|
||
StartTime1 int64 `json:"start_time_i"` // 游戏开始时间
|
||
EndTime int64 `json:"end_time"` // 结束时间
|
||
EndTime1 int64 `json:"end_time_i"` // 结束时间
|
||
TakeCoin int64 `json:"take_coin"` // 携带金币
|
||
PlayCoin int64 `json:"play_coin"` // 输赢金币
|
||
Favorite int `json:"favorite"` // 0:不收藏 1:收藏
|
||
ClubId int `json:"club_id"` // 俱乐部id
|
||
Blind int64 `json:"blind"` // 底注
|
||
PlayType int `json:"play_type"` // 玩法类型
|
||
RoomId int `json:"room_id"` // 房间id
|
||
MaxGameNum int `json:"max_game_num"` // 最大局数
|
||
GameNum int `json:"game_num"` // 实际局数
|
||
Disband int `json:"status"` // 房间状态
|
||
PlayerInfos []*GameRecordPlayerInfo `json:"player_infos"` // 玩家信息
|
||
Members int `json:"members"` // 玩家人数
|
||
}
|
||
|
||
type AGame struct {
|
||
GameAction []*GameAction `json:"g"` // 一局游戏的消息流
|
||
}
|
||
|
||
type GameAction struct {
|
||
Countdown int `json:"cd"` // 相对于发牌后的多少秒处理该消息
|
||
MsgId string `json:"id"`
|
||
Msg string `json:"msg"`
|
||
Desc string `json:"-"`
|
||
}
|
||
|
||
/*
|
||
CREATE TABLE samba.room_game_record
|
||
(
|
||
`game_no` String,
|
||
`start_time` DateTime,
|
||
`end_time` DateTime,
|
||
`actions` String,
|
||
`players` String,
|
||
`room_id` Int32,
|
||
`room_type` Int32
|
||
)
|
||
ENGINE = MergeTree
|
||
PARTITION BY toYYYYMM(start_time)
|
||
PRIMARY KEY game_no
|
||
*/
|
||
|
||
/*
|
||
use samba;
|
||
ALTER TABLE room_game_record ADD COLUMN blind Int64 DEFAULT 0 AFTER room_type;
|
||
ALTER TABLE room_game_record ADD COLUMN club_id Int32 DEFAULT 0 AFTER room_type;
|
||
alter table room_game_record add column `members` UInt32 DEFAULT 0 COMMENT '人数';
|
||
*/
|
||
|
||
// RoomGameRecord 房间游戏记录
|
||
type RoomGameRecord struct {
|
||
GameNo string `json:"game_no"` // 本局游戏唯一id
|
||
Blind int64 `json:"blind"` // 游戏底注
|
||
StartTime int64 `json:"start_time"` // 游戏开始时间
|
||
EndTime int64 `json:"end_time"` // 结束时间
|
||
Actions []*AGame `json:"actions"` // 游戏动作
|
||
Players []interface{} `json:"players"` // 房间玩家
|
||
RoomId int `json:"room_id"` // 房间动态生成id
|
||
RoomType int `json:"room_type"` // 房间类型,策划room表的id
|
||
ClubId int `json:"club_id"` // 俱乐部id
|
||
Members int `json:"members"` // 玩家人数
|
||
}
|