Files
bl/logic/service/room/pet.go
昔念 6368e2f2e9 feat(room): 增加房间宠物信息获取逻辑并优化展示条件
新增 Controller.RoomPetInfo 方法用于获取指定用户的房间宠物详细信息,
同时修复了宠物展示时可能因空数据导致的问题。在设置房间宠物展示和
处理房间装饰时增加对 CatchTime 和 ID
2025-12-13 23:52:16 +08:00

42 lines
1.7 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package room
import (
"blazing/logic/service/common"
"blazing/logic/service/pet"
)
type C2S_PetShowList struct {
// CatchTime 展示精灵的捕获时间Unix时间戳/自定义时间格式,按前端规则)
CatchTime uint32 `json:"catchTime"` // C# uint → Go uint32严格匹配32位无符号整数
// PetID 展示精灵的唯一ID
PetID uint32 `json:"petID"`
}
// C2S_PET_ROOM_SHOW 客户端→服务端的「精灵房间展示」请求结构体
// 对应前端 C2S_PET_ROOM_SHOW 结构体
type C2S_PET_ROOM_SHOW struct {
Head common.TomeeHeader `cmd:"2323" struc:"skip"` //玩家登录
PetShowInfoLen uint32 `json:"PetShowInfoLen" struc:"sizeof=PetShowList"`
// PetShowList 整个展示精灵的数组
// 业务规则展示1只精灵对应数组1个元素展示多只时所有已展示精灵的结构体均包含在内
// 数据来源前端展示精灵的map数组直接转换而来
PetShowList []C2S_PetShowList `json:"PetShowList"`
}
// S2C_PET_ROOM_SHOW 服务端→客户端的「精灵房间展示」响应结构体
// 对应前端 S2C_PET_ROOM_SHOW 结构体
type S2C_PET_ROOM_SHOW struct {
// PetShowList 整个展示精灵的数组
PetShowListLen uint32 `json:"PetShowListLen" struc:"sizeof=PetShowList"`
// 数组内每个元素为 S2C_PetShowList字段顺序petID → catchTime
PetShowList []pet.PetShortInfo `json:"PetShowList"`
}
type C2S_RoomPetInfo struct {
Head common.TomeeHeader `cmd:"2325" struc:"skip"` //玩家登录
// UserID 跟随精灵的主人用户ID
UserID uint32 `json:"userID"` // C# uint → Go uint32严格匹配32位无符号整数
// CatchTime 精灵的捕获时间Unix时间戳/前端自定义时间格式)
CatchTime uint32 `json:"catchTime"`
}