31 lines
878 B
Go
31 lines
878 B
Go
package system
|
|
|
|
import (
|
|
"blazing/common/socket/handler"
|
|
"time"
|
|
)
|
|
|
|
// LoginSidInfo 登录携带的凭证结构体
|
|
type SystemTimeInfo struct { //这里直接使用组合来实现将传入的原始头部数据和结构体参数序列化
|
|
Head handler.TomeeHeader `cmd:"1002" struc:"[0]pad"` //玩家登录
|
|
|
|
}
|
|
|
|
func (s *SystemTimeInfo) Def()[]byte { //默认返回方法
|
|
|
|
return s.Head.Pack(NewSystemTimeOutboundInfo) //返回传参
|
|
|
|
}
|
|
|
|
// SystemTimeOutboundInfo 表示系统时间的出站消息
|
|
type SystemTimeOutboundInfo struct {
|
|
SystemTime uint32 `json:"systemTime"` // 对应Java的@UInt long类型
|
|
}
|
|
|
|
// NewSystemTimeOutboundInfo 创建新的系统时间消息实例
|
|
func NewSystemTimeOutboundInfo() *SystemTimeOutboundInfo {
|
|
return &SystemTimeOutboundInfo{
|
|
SystemTime: uint32(time.Now().Unix()), // 获取当前时间戳(秒)
|
|
}
|
|
}
|