This commit is contained in:
@@ -1,56 +1,92 @@
|
||||
package controller
|
||||
|
||||
import "blazing/logic/service/common"
|
||||
import (
|
||||
"blazing/cool"
|
||||
"blazing/logic/service/common"
|
||||
"blazing/modules/player/model"
|
||||
"context"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"hash/crc32"
|
||||
)
|
||||
|
||||
type Login struct {
|
||||
// MAIN_LOGIN_IN 定义请求或响应数据结构。
|
||||
type MAIN_LOGIN_IN struct {
|
||||
Head common.TomeeHeader `cmd:"1001" struc:"skip"`
|
||||
Sid []byte `struc:"[16]byte"`
|
||||
}
|
||||
|
||||
type HeartBeat struct {
|
||||
Head common.TomeeHeader `cmd:"2051" struc:"skip"`
|
||||
Time uint32
|
||||
// CheakSession 校验登录session。
|
||||
func (l *MAIN_LOGIN_IN) CheakSession() (bool, uint32) {
|
||||
t1 := hex.EncodeToString(l.Sid)
|
||||
r, err := cool.CacheManager.Get(context.Background(), fmt.Sprintf("session:%d", l.Head.UserID))
|
||||
if err != nil {
|
||||
return false, 0
|
||||
}
|
||||
if r.String() != t1 {
|
||||
return false, 0
|
||||
}
|
||||
crc32Table := crc32.MakeTable(crc32.IEEE)
|
||||
crcValue := crc32.Checksum([]byte(l.Sid), crc32Table)
|
||||
cool.CacheManager.Remove(context.Background(), fmt.Sprintf("session:%d", l.Head.UserID))
|
||||
return true, crcValue
|
||||
}
|
||||
|
||||
type KeepAlive struct {
|
||||
Head common.TomeeHeader `cmd:"2052" struc:"skip"`
|
||||
Time uint32
|
||||
// SimUserInfoInboundInfo 定义请求或响应数据结构。
|
||||
type SimUserInfoInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2051" struc:"skip"`
|
||||
UserId uint32 `fieldDescription:"米米号" uint:"true" codec:"true"`
|
||||
}
|
||||
|
||||
type UserInfo struct {
|
||||
// MoreUserInfoInboundInfo 定义请求或响应数据结构。
|
||||
type MoreUserInfoInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2052" struc:"skip"`
|
||||
UserId uint32 `fieldDescription:"米米号" uint:"true" codec:"true"`
|
||||
}
|
||||
|
||||
// AimatInboundInfo 定义请求或响应数据结构。
|
||||
type AimatInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2104" struc:"skip"`
|
||||
UserID uint32
|
||||
ShowNono uint8
|
||||
RoomStyle uint32
|
||||
ItemId uint32 `description:"物品id 射击激光 物品id为0" codec:"auto" uint:"true"`
|
||||
ShootType uint32 `description:"射击类型 未知 给0" codec:"auto" uint:"true"`
|
||||
Point model.Pos `description:"射击的坐标 x y" codec:"auto"`
|
||||
}
|
||||
|
||||
type UserTalk struct {
|
||||
// ChatInboundInfo 定义请求或响应数据结构。
|
||||
type ChatInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2102" struc:"skip"`
|
||||
ReceiverID uint32
|
||||
MessageLen uint32 `struc:"sizeof=Message"`
|
||||
Message []byte
|
||||
Reserve uint32 `json:"reserve" fieldDescription:"填充 默认值为0" uint:"true"`
|
||||
MessageLen uint32 `struc:"sizeof=Message"`
|
||||
Message string `json:"message" fieldDescription:"消息内容, 结束符为utf-8的数字0"`
|
||||
}
|
||||
|
||||
type ChangeTitle struct {
|
||||
// ChangeColorInboundInfo 定义请求或响应数据结构。
|
||||
type ChangeColorInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2063" struc:"skip"`
|
||||
Title uint32
|
||||
Color uint32 `codec:"color"`
|
||||
}
|
||||
|
||||
type ChangePlayerIcon struct {
|
||||
Head common.TomeeHeader `cmd:"2062" struc:"skip"`
|
||||
Icon uint32
|
||||
// ChangeDoodleInboundInfo 定义请求或响应数据结构。
|
||||
type ChangeDoodleInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2062" struc:"skip"`
|
||||
Id uint32 `codec:"id"`
|
||||
Color uint32 `codec:"color"`
|
||||
}
|
||||
|
||||
type GetMotto struct {
|
||||
Head common.TomeeHeader `cmd:"9012" struc:"skip"`
|
||||
// ChangeNONOColorInboundInfo 定义请求或响应数据结构。
|
||||
type ChangeNONOColorInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"9012" struc:"skip"`
|
||||
Color uint32 `codec:"color"`
|
||||
}
|
||||
|
||||
type GetTask struct {
|
||||
Head common.TomeeHeader `cmd:"2103" struc:"skip"`
|
||||
TaskLen uint32 `struc:"sizeof=TaskList"`
|
||||
TaskList []uint32
|
||||
// C2SDanceAction 定义请求或响应数据结构。
|
||||
type C2SDanceAction struct {
|
||||
Head common.TomeeHeader `cmd:"2103" struc:"skip"`
|
||||
Reserve uint32 `struc:"uint32,big"`
|
||||
Type uint32 `struc:"uint32,big"`
|
||||
}
|
||||
|
||||
// C2SPEOPLE_TRANSFROM 定义请求或响应数据结构。
|
||||
type C2SPEOPLE_TRANSFROM struct {
|
||||
Head common.TomeeHeader `cmd:"2111" struc:"skip"`
|
||||
SuitID uint32 `struc:"uint32,big"`
|
||||
|
||||
Reference in New Issue
Block a user