github.com/lianghucheng/zrddz@v0.0.0-20200923083010-c71f680932e2/src/msg/msg.go (about) 1 package msg 2 3 import ( 4 "github.com/name5566/leaf/network/json" 5 "gopkg.in/mgo.v2/bson" 6 ) 7 8 var Processor = json.NewProcessor() 9 10 func init() { 11 Processor.Register(&C2S_SetSystemOn{}) 12 Processor.Register(&C2S_SetLandlordConfig{}) 13 Processor.Register(&C2S_SetUsernamePassword{}) 14 Processor.Register(&C2S_SetUserRole{}) 15 Processor.Register(&C2S_TransferChips{}) 16 Processor.Register(&C2S_WeChatLogin{}) 17 Processor.Register(&C2S_TokenLogin{}) 18 Processor.Register(&C2S_UsernamePasswordLogin{}) 19 Processor.Register(&C2S_Heartbeat{}) 20 Processor.Register(&C2S_CreateLandlordRoom{}) 21 Processor.Register(&C2S_EnterRoom{}) 22 Processor.Register(&C2S_GetUserChips{}) 23 Processor.Register(&C2S_SetVIPRoomChips{}) 24 Processor.Register(&C2S_GetCheckInDetail{}) 25 Processor.Register(&C2S_CheckIn{}) 26 Processor.Register(&C2S_GetAllPlayers{}) 27 Processor.Register(&C2S_ExitRoom{}) 28 Processor.Register(&C2S_LandlordPrepare{}) //准备游戏 29 Processor.Register(&C2S_LandlordMatching{}) 30 Processor.Register(&C2S_LandlordBid{}) 31 Processor.Register(&C2S_LandlordGrab{}) 32 Processor.Register(&C2S_LandlordDouble{}) 33 Processor.Register(&C2S_LandlordShowCards{}) 34 Processor.Register(&C2S_LandlordDiscard{}) 35 Processor.Register(&C2S_GetMonthChipsRank{}) 36 Processor.Register(&C2S_GetMonthChipsRankPos{}) 37 Processor.Register(&C2S_GetMonthWinsRank{}) 38 Processor.Register(&C2S_GetMonthWinsRankPos{}) 39 Processor.Register(&C2S_CleanMonthRanks{}) 40 Processor.Register(&C2S_SystemHost{}) 41 Processor.Register(&C2S_ChangeTable{}) 42 Processor.Register(&C2S_GetRedPacketMatchRecord{}) 43 Processor.Register(&C2S_TakeRedPacketMatchPrize{}) 44 Processor.Register(&C2S_DoTask{}) 45 Processor.Register(&C2S_ChangeTask{}) 46 Processor.Register(&C2S_FreeChangeCountDown{}) 47 Processor.Register(&C2S_TakeTaskPrize{}) 48 Processor.Register(&C2S_FakeWXPay{}) 49 Processor.Register(&C2S_FakeAliPay{}) 50 Processor.Register(&C2S_GetCircleLoginCode{}) 51 52 Processor.Register(&S2C_SetSystemOn{}) 53 Processor.Register(&S2C_SetLandlordConfig{}) 54 Processor.Register(&S2C_SetUserRole{}) 55 Processor.Register(&S2C_TransferChips{}) 56 Processor.Register(&S2C_UpdateUserChips{}) 57 Processor.Register(&S2C_SetVIPRoomChips{}) 58 Processor.Register(&S2C_CheckInDetail{}) 59 Processor.Register(&S2C_UpdateCheckInDetail{}) 60 Processor.Register(&S2C_UpdateNotice{}) 61 Processor.Register(&S2C_UpdateRadio{}) 62 Processor.Register(&S2C_Close{}) 63 Processor.Register(&S2C_Login{}) 64 Processor.Register(&S2C_Heartbeat{}) 65 Processor.Register(&S2C_CreateRoom{}) 66 Processor.Register(&S2C_EnterRoom{}) 67 Processor.Register(&S2C_SitDown{}) 68 Processor.Register(&S2C_StandUp{}) 69 Processor.Register(&S2C_ExitRoom{}) 70 Processor.Register(&S2C_Prepare{}) 71 Processor.Register(&S2C_GameStart{}) 72 Processor.Register(&S2C_UpdatePokerHands{}) 73 Processor.Register(&S2C_ActionLandlordBid{}) 74 Processor.Register(&S2C_LandlordBid{}) 75 Processor.Register(&S2C_ActionLandlordGrab{}) 76 Processor.Register(&S2C_LandlordGrab{}) 77 Processor.Register(&S2C_DecideLandlord{}) 78 Processor.Register(&S2C_UpdateLandlordLastThree{}) 79 Processor.Register(&S2C_ActionLandlordDouble{}) 80 Processor.Register(&S2C_LandlordDouble{}) 81 Processor.Register(&S2C_ActionLandlordShowCards{}) 82 Processor.Register(&S2C_LandlordShowCards{}) 83 Processor.Register(&S2C_UpdateLandlordMultiple{}) 84 Processor.Register(&S2C_ActionLandlordDiscard{}) 85 Processor.Register(&S2C_LandlordDiscard{}) 86 Processor.Register(&S2C_ClearAction{}) 87 Processor.Register(&S2C_LandlordSpring{}) 88 Processor.Register(&S2C_LandlordRoundResult{}) 89 Processor.Register(&S2C_UpdateMonthChipsRankPos{}) 90 Processor.Register(&S2C_UpdateMonthChipsRanks{}) 91 Processor.Register(&S2C_UpdateMonthWinsRankPos{}) 92 Processor.Register(&S2C_UpdateMonthWinsRanks{}) 93 Processor.Register(&S2C_CleanMonthRanks{}) 94 Processor.Register(&S2C_UpdatePlayerChips{}) 95 Processor.Register(&S2C_SystemHost{}) 96 Processor.Register(&S2C_RedPacketMatchRecord{}) 97 Processor.Register(&S2C_TakeRedPacketMatchPrize{}) 98 Processor.Register(&S2C_UpdateUntakenRedPacketMatchPrizeNumber{}) 99 Processor.Register(&S2C_UpdateRedPacketMatchOnlineNumber{}) 100 Processor.Register(&S2C_UpdateRedPacketTaskList{}) 101 Processor.Register(&S2C_UpdateChipTaskList{}) 102 Processor.Register(&S2C_UpdateTaskProgress{}) 103 Processor.Register(&S2C_TakeTaskPrize{}) 104 Processor.Register(&S2C_ChangeTask{}) 105 Processor.Register(&S2C_FreeChangeCountDown{}) 106 Processor.Register(&S2C_PayOK{}) 107 Processor.Register(&S2C_UpdateCircleLoginCode{}) 108 109 Processor.Register(&C2S_SetRobotData{}) 110 111 Processor.Register(&S2C_OfferSubsidy{}) 112 Processor.Register(&C2S_GetCardMa{}) 113 Processor.Register(&S2C_CardMa{}) 114 Processor.Register(&S2C_RedPacketTaskRecord{}) 115 Processor.Register(&C2S_CardCodeState{}) 116 Processor.Register(&C2S_TakeTaskState{}) 117 Processor.Register(&S2C_CircleLink{}) 118 Processor.Register(&C2S_SubsidyChip{}) 119 Processor.Register(&S2C_SubsidyChip{}) 120 Processor.Register(&S2C_TakenSubsidyChip{}) 121 Processor.Register(&C2S_IsExistSubsidy{}) 122 123 Processor.Register(&C2S_DailySign{}) 124 Processor.Register(&S2C_DailySign{}) 125 Processor.Register(&S2C_DailySignItems{}) 126 } 127 128 type C2S_Heartbeat struct{} 129 130 type S2C_Heartbeat struct{} 131 132 type C2S_TransferChips struct { 133 AccountID int 134 Chips int64 135 } 136 137 const ( 138 S2C_TransferChips_OK = 0 139 S2C_TransferChips_AccountIDInvalid = 1 // 账号ID无效 140 S2C_TransferChips_NotYourself = 2 // 不能转给自己 141 S2C_TransferChips_ChipsInvalid = 3 // 筹码数量 + C2S_TransferChip.Chips + 无效 142 S2C_TransferChips_PermissionDenied = 4 // 没有权限 143 ) 144 145 type S2C_TransferChips struct { 146 Error int 147 Chips int64 148 } 149 150 type C2S_GetCheckInDetail struct { 151 } 152 153 type C2S_CheckIn struct { 154 } 155 156 type S2C_CheckInDetail struct { 157 CheckIn bool 158 CheckInSum int 159 } 160 161 type S2C_UpdateCheckInDetail struct { 162 CheckIn bool 163 CheckInSum int 164 } 165 166 type S2C_Prepare struct { 167 Position int 168 Ready bool 169 } 170 171 type S2C_GameStart struct{} 172 173 type S2C_UpdatePokerHands struct { 174 Position int 175 Hands []int // 手牌 176 NumberOfHands int // 手牌数量 177 ShowCards bool // 明牌 178 } 179 180 // 获取红包比赛记录 181 type C2S_GetRedPacketMatchRecord struct { 182 PageNumber int // 页码数 183 PageSize int // 一页显示的条数 184 } 185 186 type RedPacketMatchRecordItem struct { 187 ID bson.ObjectId 188 RedPacketType int 189 RedPacket float64 190 Taken bool 191 Date string 192 CardCode string //红包码 193 } 194 195 type S2C_RedPacketMatchRecord struct { 196 Items []RedPacketMatchRecordItem 197 Total int // 总数 198 PageNumber int // 页码数 199 PageSize int // 一页显示的条数 200 } 201 202 // 领取红包比赛奖励 203 type C2S_TakeRedPacketMatchPrize struct { 204 ID bson.ObjectId 205 } 206 207 const ( 208 S2C_TakeRedPacketMatchPrize_OK = 0 // 恭喜领取 S2C_TakeRedPacketMatchPrize.RedPacket元红包奖励,请至“圈圈”查看 209 S2C_TakeRedPacketMatchPrize_IDInvalid = 1 // 比赛记录ID无效 210 S2C_TakeRedPacketMatchPrize_NotYetWon = 2 // 离获奖还差一点点,请继续努力吧 211 S2C_TakeRedPacketMatchPrize_TakeRepeated = 3 // S2C_TakeRedPacketMatchPrize.RedPacket元红包奖励已被领取,请勿重复操作 212 S2C_TakeRedPacketMatchPrize_CircleIDInvalid = 4 // 圈圈ID无效 213 S2C_TakeRedPacketMatchPrize_Error = 5 // 领取出错,请稍后重试 214 ) 215 216 // 领取红包比赛奖励 217 type S2C_TakeRedPacketMatchPrize struct { 218 Error int 219 ID bson.ObjectId 220 RedPacket float64 221 } 222 223 // 更新未领取的红包比赛奖励数量 224 type S2C_UpdateUntakenRedPacketMatchPrizeNumber struct { 225 Number int 226 } 227 228 // 更新红包比赛在线人数 229 type S2C_UpdateRedPacketMatchOnlineNumber struct { 230 Numbers []int 231 } 232 233 type C2S_FakeWXPay struct { 234 TotalFee int 235 } 236 237 type C2S_FakeAliPay struct { 238 TotalAmount float64 239 } 240 241 // 购买S2C_PayOK.Chips金币成功 242 type S2C_PayOK struct { 243 Chips int64 244 } 245 246 type C2S_GetCircleLoginCode struct{} 247 248 const ( 249 S2C_UpdateCircleLoginCode_OK = 0 250 S2C_UpdateCircleLoginCode_Error = 1 // 圈圈授权出错,请稍后重试 251 ) 252 253 type S2C_UpdateCircleLoginCode struct { 254 Error int 255 LoginCode string 256 } 257 258 // robot 259 type C2S_SetRobotData struct { 260 LoginIP string 261 Chips int64 262 } 263 type C2S_CardCodeState struct { 264 } 265 266 const ( 267 SubsidyOK = 0 268 SubsidyMore = 1 269 SubsidyNotLack = 3 270 ) 271 type S2C_SubsidyChip struct { 272 Error int 273 Chip int 274 SubsidyTimes int 275 TotalTimes int 276 } 277 278 type S2C_TakenSubsidyChip struct { 279 Chip int 280 } 281 282 type C2S_SubsidyChip struct { 283 Reply bool 284 } 285 286 type C2S_IsExistSubsidy struct { 287 } 288 289 type C2S_DailySign struct { 290 291 } 292 293 type S2C_DailySign struct { 294 Chips int64 //获取的金币 295 } 296 297 type S2C_DailySignItems struct { 298 SignItems []DailySignItems 299 IsSign bool //今日是否已签到 300 } 301 302 const ( 303 SignFinish = 1 304 SignAccess = 2 305 SignDeny = 3 306 ) 307 308 type DailySignItems struct { 309 Chips int64 310 Status int 311 }