Files
bl/logic/controller/pet_info_helpers.go
xinian e71971d0b4
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
refactor: 重构宠物背包逻辑到玩家服务
2026-04-05 05:47:25 +08:00

41 lines
970 B
Go

package controller
import (
"blazing/logic/service/pet"
"blazing/modules/player/model"
)
func buildPetShortInfo(info model.PetInfo) pet.PetShortInfo {
return pet.PetShortInfo{
ID: info.ID,
CatchTime: info.CatchTime,
Level: info.Level,
SkinID: info.SkinID,
ShinyLen: info.ShinyLen,
ShinyInfo: info.ShinyInfo,
}
}
func buildPetListOutboundInfo(petList []model.PetInfo) *pet.GetPetListOutboundInfo {
result := &pet.GetPetListOutboundInfo{
ShortInfoList: make([]pet.PetShortInfo, len(petList)),
}
for i := range petList {
result.ShortInfoList[i] = buildPetShortInfo(petList[i])
}
return result
}
func buildPetShowOutboundInfo(userID, flag uint32, info *model.PetInfo) *pet.PetShowOutboundInfo {
return &pet.PetShowOutboundInfo{
UserID: userID,
CatchTime: info.CatchTime,
ID: info.ID,
Flag: flag,
Dv: info.Dv,
ShinyLen: info.ShinyLen,
ShinyInfo: info.ShinyInfo,
SkinID: info.SkinID,
}
}