feat: 新增服务器冠名CDK兑换功能
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed

This commit is contained in:
xinian
2026-04-08 15:49:03 +08:00
committed by cnb
parent 9825944efc
commit 1ca0ff344e
6 changed files with 194 additions and 72 deletions

View File

@@ -1,92 +1,56 @@
package controller
import (
"blazing/cool"
"blazing/logic/service/common"
"blazing/modules/player/model"
"context"
"encoding/hex"
"fmt"
"hash/crc32"
)
import "blazing/logic/service/common"
// MAIN_LOGIN_IN 定义请求或响应数据结构。
type MAIN_LOGIN_IN struct {
type Login struct {
Head common.TomeeHeader `cmd:"1001" struc:"skip"`
Sid []byte `struc:"[16]byte"`
}
// CheakSession 处理控制器请求。
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 HeartBeat struct {
Head common.TomeeHeader `cmd:"2051" struc:"skip"`
Time uint32
}
// SimUserInfoInboundInfo 定义请求或响应数据结构。
type SimUserInfoInboundInfo struct {
Head common.TomeeHeader `cmd:"2051" struc:"skip"`
UserId uint32 `fieldDescription:"米米号" uint:"true" codec:"true"`
type KeepAlive struct {
Head common.TomeeHeader `cmd:"2052" struc:"skip"`
Time uint32
}
// MoreUserInfoInboundInfo 定义请求或响应数据结构。
type MoreUserInfoInboundInfo struct {
Head common.TomeeHeader `cmd:"2052" struc:"skip"`
UserId uint32 `fieldDescription:"米米号" uint:"true" codec:"true"`
}
// AimatInboundInfo 定义请求或响应数据结构。
type AimatInboundInfo struct {
type UserInfo struct {
Head common.TomeeHeader `cmd:"2104" struc:"skip"`
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"`
UserID uint32
ShowNono uint8
RoomStyle uint32
}
// ChatInboundInfo 定义请求或响应数据结构。
type ChatInboundInfo struct {
type UserTalk struct {
Head common.TomeeHeader `cmd:"2102" struc:"skip"`
Reserve uint32 `json:"reserve" fieldDescription:"填充 默认值为0" uint:"true"`
MessageLen uint32 `struc:"sizeof=Message"`
Message string `json:"message" fieldDescription:"消息内容, 结束符为utf-8的数字0"`
ReceiverID uint32
MessageLen uint32 `struc:"sizeof=Message"`
Message []byte
}
// ChangeColorInboundInfo 定义请求或响应数据结构。
type ChangeColorInboundInfo struct {
type ChangeTitle struct {
Head common.TomeeHeader `cmd:"2063" struc:"skip"`
Color uint32 `codec:"color"`
Title uint32
}
// ChangeDoodleInboundInfo 定义请求或响应数据结构。
type ChangeDoodleInboundInfo struct {
Head common.TomeeHeader `cmd:"2062" struc:"skip"`
Id uint32 `codec:"id"`
Color uint32 `codec:"color"`
type ChangePlayerIcon struct {
Head common.TomeeHeader `cmd:"2062" struc:"skip"`
Icon uint32
}
// ChangeNONOColorInboundInfo 定义请求或响应数据结构。
type ChangeNONOColorInboundInfo struct {
Head common.TomeeHeader `cmd:"9012" struc:"skip"`
Color uint32 `codec:"color"`
type GetMotto struct {
Head common.TomeeHeader `cmd:"9012" struc:"skip"`
}
// C2SDanceAction 定义请求或响应数据结构。
type C2SDanceAction struct {
Head common.TomeeHeader `cmd:"2103" struc:"skip"`
Reserve uint32 `struc:"uint32,big"`
Type uint32 `struc:"uint32,big"`
type GetTask struct {
Head common.TomeeHeader `cmd:"2103" struc:"skip"`
TaskLen uint32 `struc:"sizeof=TaskList"`
TaskList []uint32
}
// C2SPEOPLE_TRANSFROM 定义请求或响应数据结构。
type C2SPEOPLE_TRANSFROM struct {
Head common.TomeeHeader `cmd:"2111" struc:"skip"`
SuitID uint32 `struc:"uint32,big"`
@@ -106,6 +70,13 @@ type ChangeTitleInboundInfo struct {
// C2S_GET_GIFT_COMPLETE 定义请求或响应数据结构。
type C2S_GET_GIFT_COMPLETE struct {
Head common.TomeeHeader `cmd:"2801" struc:"skip"`
PassText string `struc:"[16]byte"`
Head common.TomeeHeader `cmd:"2801" struc:"skip"`
PassText string `struc:"[16]byte"`
Type uint32
ServerID uint32
ServerName string `struc:"[16]byte"`
}
type C2S_GET_DONATION_SERVER_IDS struct {
Head common.TomeeHeader `cmd:"2802" struc:"skip"`
}