room_data.go 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  1. package proto
  2. import (
  3. item "bet24.com/servers/micros/item_inventory/proto"
  4. user "bet24.com/servers/micros/userservices/proto"
  5. )
  6. const (
  7. Role_Guest = iota // 0=游客
  8. Role_Administrator // 1=管理员
  9. Role_Assistant // 2=助理
  10. Role_Member // 3=成员
  11. Role_MAX // 无效值
  12. )
  13. // 动作
  14. const (
  15. Notify_Action_Invalid = iota // 0=无效
  16. Notify_Action_Refresh_Room // 1=刷新房间
  17. Notify_Action_Refresh_User // 2=刷新用户
  18. Notify_Action_Refresh_Mic // 3=刷新麦
  19. Notify_Action_Giving // 4=礼物
  20. Notify_Action_Screen_Lock // 5=屏幕锁
  21. Notify_Action_Refresh_RoomImg // 6=刷新房间封面
  22. Notify_Action_Refresh_Game // 7=刷新游戏
  23. )
  24. // 原因
  25. const (
  26. Notify_Reason_None = 0 // 0=没有原因
  27. Notify_Reason_User_Online = 11 // 11=用户上线(给用户ID数据)
  28. Notify_Reason_User_Offline = 12 // 12=用户离线(给用户ID数据)
  29. Notify_Reason_User_ChangeRole = 13 // 13=变更角色
  30. Notify_Reason_User_Invite = 14 // 14=邀请
  31. Notify_Reason_User_AddRoomBlack = 15 // 15=房间拉黑(不需要进一步数据)
  32. Notify_Reason_User_RemoveRoomBlack = 16 // 16=移除房间黑名单(不需要通知,弃用)
  33. Notify_Reason_User_AddMicBlack = 17 // 17=麦位拉黑(给用户ID数据)
  34. Notify_Reason_User_RemoveMicBlack = 18 // 18=移除麦位黑名单
  35. Notify_Reason_User_Level_Up = 19 // 19=等级升级
  36. Notify_Reason_Mic_Change = 21 // 21=麦位变化(包括锁麦、解锁麦位和自己上麦、主动下麦、扩麦、缩麦、麦数量)
  37. Notify_Reason_Mic_Invite = 22 // 22=麦位邀请
  38. Notify_Reason_Mic_Kick = 23 // 23=强制下麦(踢麦)
  39. Notify_Reason_Mic_AddMicBlack = 24 // 24=麦位拉黑
  40. Notify_Reason_Mic_RemoveMicBlack = 25 // 25=移除麦位黑名单(不需要通知,弃用)
  41. Notify_Reason_Screen_Lock = 26 // 26=用户屏幕锁
  42. Notify_Reason_User_Mic_Apply = 27 // 27=麦位申请
  43. Notify_Reason_User_Mic_Apply_Agree = 28 // 28=麦位申请同意
  44. Notify_Reason_User_Mic_Apply_Cancel = 29 // 29=麦位申请取消(拒绝)
  45. Notify_Reason_Game_CreateRoom = 30 // 30=创建游戏房间
  46. Notify_Reason_Game_CloseRoom = 31 // 31=关闭游戏房间
  47. )
  48. type ReasonData struct {
  49. Reason int // 原因类型
  50. NotifyUserId int `json:"-"` // 通知的用户id
  51. UserId int `json:",omitempty"` // 用户id
  52. NickName string `json:",omitempty"` // 昵称
  53. FaceId int `json:",omitempty"` // 头像Id
  54. FaceUrl string `json:",omitempty"` // 头像Url
  55. OldRoleId int `json:",omitempty"` // 旧角色id
  56. NewRoleId int `json:",omitempty"` // 新角色Id
  57. SN int `json:",omitempty"` // 麦位
  58. Code string `json:",omitempty"` // code码
  59. ScreenLock int `json:",omitempty"` // 屏幕锁的状态(1:是,0:否)
  60. MicApplyCount int `json:",omitempty"` // 麦位申请数
  61. GameId int `json:",omitempty"` // 游戏id
  62. RuleName string `json:",omitempty"` // 游戏玩法
  63. }
  64. const (
  65. Permission_Close = iota // 0=关闭
  66. Permission_Open // 1=开启
  67. )
  68. const (
  69. PermissionType_Invalid = iota // 0=无效
  70. PermissionType_Mic // 1=麦位
  71. PermissionType_Room // 2=房间
  72. PermissionType_Game_Pinggo // 3=pinggo 游戏
  73. PermissionType_Max
  74. )
  75. // 游戏权限
  76. var GamePermissions = []struct {
  77. GameId int
  78. PermissionType int
  79. }{
  80. {
  81. GameId: 41,
  82. PermissionType: PermissionType_Game_Pinggo,
  83. },
  84. }
  85. const (
  86. BlackType_Invalid = iota // =0无效
  87. BlackType_Room // 1=房间黑名单
  88. BlackType_Mic // 2=麦位黑名单
  89. BlackType_Max
  90. )
  91. const (
  92. OnMic_All = iota // 0=房间内所有人自由上麦
  93. OnMic_Member // 1=加入为成员才可以上麦
  94. OnMic_Manager // 2=仅限管理员邀请或者管理员才能上麦(包含创建者)
  95. OnMic_Apply // 3=申请上麦
  96. )
  97. const (
  98. OperateType_KickMic = 11 // 11=踢麦
  99. OperateType_ForbidMic = 21 // 21=禁麦
  100. OperateType_UnforbidMic = 22 // 22=解麦
  101. OperateType_AddBlack = 31 // 31=添加房间黑名单
  102. OperateType_RemoveBlack = 32 // 32=移除房间黑名单
  103. )
  104. // 房间配置
  105. type RoomConfig struct {
  106. SysNotification string // 系统公告
  107. Tag []string // 标签
  108. Country []string // 国家
  109. Language []string // 语言
  110. MicCount []int // 上麦数量
  111. JoinFee Fee // 入场会费
  112. PwdLockSeconds int // 房间密码锁有效时长(秒)
  113. RoomBlackSeconds int // 房间黑名单时长(秒)
  114. GivingCount []int // 礼物数量
  115. GivingDiamondMax int // 最大礼物
  116. DayExpLimit int // 房间经验上限
  117. DayLimits []DayLimit // 每天上限
  118. CollectShowPoint int // 收集显示点数
  119. MemoryRooms int // 内存房间数
  120. TopRooms []int // 置顶房间
  121. }
  122. // 每天上限
  123. type DayLimit struct {
  124. Action int // 动作
  125. Exps int // 经验值
  126. }
  127. // 入场会费
  128. type Fee struct {
  129. Min int // 最低费用
  130. Max int // 最高费用
  131. Tax int // 税费(百分比)
  132. }
  133. // 语音房间基本信息
  134. type RoomInfo struct {
  135. RoomId int // 房间ID
  136. RoomName string // 房间名称
  137. RoomImg string // 房间图片
  138. UserId int // 用户ID
  139. Family string // 家族
  140. Country string // 国家
  141. Language string // 语言
  142. MicCount int // 上麦数量
  143. MicMode int // 麦位模式(1=房间内所有人自由上麦 2=房间内所有人自由上麦 3=仅限管理员邀请或者管理员才能上麦(包含创建者))
  144. JoinFee int // 入会费
  145. Announce string // 公告内容
  146. Tag string // 标签(游戏、闲聊、交友、家族、仅限女孩)
  147. MemberCount int // 会员数
  148. Crdate string // 创建时间
  149. OnlineCount int // 在线用户数
  150. Level int // 等级
  151. Exps int // 经验
  152. TopFlag bool // 置顶标识
  153. }
  154. // 语音房扩展信息
  155. type RoomExtInfo struct {
  156. CollectDiamond int // 收集钻石
  157. DayExps int // 日经验值
  158. ScreenLock int // 屏幕锁(1:是,0:否)
  159. UpdateTime int // 更新时间戳
  160. }
  161. // 用户房间信息
  162. type UserRoomInfo struct {
  163. UserId int
  164. RoomId int // 房间id
  165. RoleId int // 角色ID(0=游客 1=管理员 2=助理 3=成员 4=关注)
  166. Level int // 等级
  167. Exps int // 经验
  168. DayExps int // 日经验值
  169. UpdateTime int // 更新时间戳
  170. Crdate string // 创建时间
  171. }
  172. // 麦位信息
  173. type MicInfo struct {
  174. UserId int // 麦位用户(-1=锁定 0=空闲 >0=坐下)
  175. StreamId string // 流ID
  176. TimeStamp int // 时间戳
  177. }
  178. // 麦位日志
  179. type MicLog struct {
  180. UserId int // 麦位用户(-1=锁定 0=空闲 >0=坐下)
  181. StreamId string // 流ID
  182. RoleID int // 角色id
  183. SN int // 麦位序号
  184. MicMode int // 麦位模式
  185. OnMicStamp int // 上麦时间戳
  186. OpUserId int // 操作员id
  187. }
  188. // 黑名单
  189. type BlackInfo struct {
  190. UserId int // 用户ID
  191. BlackTypes []BlackType // 黑名单类型列表
  192. }
  193. // 黑名单类型
  194. type BlackType struct {
  195. BlackType int // 黑名单类型(1=房间黑名单 2=麦位黑名单)
  196. ExpireTimeStamp int // 过期时间戳
  197. }
  198. // 黑名单用户
  199. type BlackUser struct {
  200. *user.UserHotInfo // 用户信息
  201. StillSeconds int // 剩余时间(秒)
  202. }
  203. // 房间操作记录
  204. type OperateInfo struct {
  205. UserId int // 用户ID
  206. UserBaseInfo *user.UserHotInfo
  207. ToUserId int // 对象用户ID
  208. ToUserBaseInfo *user.UserHotInfo
  209. OperateType int // 操作类型
  210. Crdate string // 时间
  211. }
  212. // 在线用户信息
  213. type UserInfo struct {
  214. *user.UserHotInfo
  215. RoleId int // 角色id
  216. IsMicBlack bool // 是否麦位黑名单
  217. Level int // 等级
  218. Exps int `json:",omitempty"` // 经验值
  219. IsOnline bool `json:",omitempty"` // 是否在线
  220. }
  221. // 权限信息
  222. type PermissionInfo struct {
  223. PermissionType int // 权限类型(1=麦位锁)
  224. Enabled int // 是否启用(0=未启用 1=已启用)
  225. }
  226. // 房间进入条件
  227. type EnterCondition struct {
  228. InviteOnly bool // 只能邀请加入(暂不使用)
  229. PwdExpire int // 过期时间戳(暂不使用)
  230. Password string // 密码锁
  231. IsHide bool // 是否隐藏
  232. }
  233. const (
  234. _ = iota
  235. RoomTask_Action_OnMic // 1=上麦
  236. RoomTask_Action_Giving_Diamond // 2=赠送钻石礼物
  237. RoomTask_Action_Giving_Gold // 3=赠送金币礼物
  238. )
  239. const (
  240. _ = iota
  241. UserTask_Action_OnMic // 1=使用麦克风
  242. UserTask_Action_SendMessage // 2=房间内发送消息
  243. UserTask_Action_ShareRoom // 3=分享房间
  244. UserTask_Action_AcceptGiving_Diamond // 4=收到钻石礼物
  245. UserTask_Action_SendGiving_Diamond // 5=赠送钻石礼物
  246. )
  247. // 房间任务配置
  248. type TaskConfig struct {
  249. Id int // id
  250. Name string // 名称
  251. Desc string // 描述
  252. Action int // 触发动作
  253. Target int // 目标
  254. NeedNum int // 数值
  255. Exps []float64 // 经验值
  256. StatValue int `json:",omitempty"` // 统计值
  257. }
  258. // 房间升级配置
  259. type UpgradeConfig struct {
  260. Level int // 等级
  261. Exps int // 经验
  262. Icon int `json:",omitempty"` // 图标
  263. Ratio float64 `json:",omitempty"` // 比率
  264. }
  265. // 房间任务
  266. type RoomTask struct {
  267. TaskId int // 任务id
  268. Schedule int // 进度
  269. CurrNum int // 当前数值
  270. TimeStamp int // 时间戳
  271. }
  272. const (
  273. CollectStatus_Active = iota // 0=进行中
  274. CollectStatus_Complete // 1=完成
  275. CollectStatus_Awarded // 2=已领取奖励
  276. )
  277. // 房间收集
  278. type RoomCollect struct {
  279. DayIndex int // 日索引
  280. Points int // 总点数
  281. Ratio float64 // 比率
  282. Award []item.ItemPack // 奖励
  283. Status int // 状态
  284. }
  285. // 用户贡献
  286. type UserContribute struct {
  287. RoomId int // 房间Id
  288. Action int // 动作
  289. Exps int // 经验
  290. Expire int // 过期时间戳
  291. }
  292. // 用户房间任务
  293. type UserRoomTask struct {
  294. RoomTask
  295. Status int // 状态
  296. }
  297. // 房间任务统计
  298. type UserRoomTaskStat struct {
  299. TaskId int // 任务ID
  300. FinishNum int // 完成数
  301. }
  302. // 游戏配置
  303. type GameConfig struct {
  304. Id int // ID
  305. Name string // 名称
  306. Desc string // 描述
  307. Plays []PlayConfig `json:",omitempty"`
  308. Sort int // 排序
  309. StartGameRoom bool `json:",omitempty"` // 游戏房间是否已开启
  310. GameRules []string `json:",omitempty"` // 创建游戏的玩法列表
  311. IsShow bool // 是否显示
  312. }
  313. // 玩法配置
  314. type PlayConfig struct {
  315. PlayType int // 玩法类型
  316. Desc string // 描述
  317. Numbers []int // 数字组合
  318. Fees []CombFee // 付费组合
  319. }
  320. // 付费(vip、成员、工会)
  321. type CombFee struct {
  322. Scene int // 场景,不同的场景有不同的扣费规则
  323. Desc string // 描述
  324. Items []item.ItemPack // 游戏费用
  325. }
  326. // 礼物记录
  327. type GiftHistory struct {
  328. RoomId int // 房间ID
  329. Sender int // 发送者
  330. Receiver int // 接收者
  331. GiftId int // 礼物ID
  332. GiftNum int // 礼物数量
  333. DiamondAmount int // 钻石数
  334. GoldAmount int // 金币数
  335. }
  336. // 操作消息
  337. type RetMsg struct {
  338. RetCode int // 操作结果
  339. Message string // 操作消息
  340. }
  341. // 麦位申请状态
  342. const (
  343. MicApply_Status_Apply = iota // 0=申请中
  344. MicApply_Status_Agree // 1=同意
  345. MicApply_Status_Reject // 2=拒绝
  346. MicApply_Status_Cancel // 3=取消
  347. )