refactor(service): 重构物品、宠物和任务服务,统一使用EX模型和回调函数处理数据操作

This commit is contained in:
1
2025-09-23 15:01:52 +00:00
parent 1ee43e1319
commit 9c5cfa151a
12 changed files with 100 additions and 481 deletions

View File

@@ -30,7 +30,7 @@ func (h *Controller) GetPetInfo(
if result == nil {
result = &pet.OutInfo{
PetInfo: c.Service.GetPetInfo(data.CatchTime),
PetInfo: c.Service.PetInfo_One(data.CatchTime).Data,
}
}
@@ -44,7 +44,7 @@ func (h *Controller) GetPetList(
err errorcode.ErrorCode) { //这个时候player应该是空的
result = &pet.GetPetListOutboundInfo{}
tt := c.Service.GetPetList(0) //获得未放生的精灵
tt := c.Service.PetInfo(0) //获得未放生的精灵
result.ShortInfoList = make([]pet.PetShortInfo, len(tt))
for i, v := range tt {
@@ -66,7 +66,10 @@ func (h *Controller) PetRelease(
result = &pet.PetReleaseOutboundInfo{}
result.Flag = uint32(data.Flag)
t := c.Service.PetM(int(data.CatchTime), int(data.Flag))
c.Service.PetInfo_One_exec(data.CatchTime, func(t *model.PetEX) {
t.InBag = int(data.Flag)
})
switch data.Flag {
case 0:
@@ -84,8 +87,11 @@ func (h *Controller) PetRelease(
case 1:
//todo 背包
c.Info.PetList = append(c.Info.PetList, t)
result.PetInfo = t
c.Service.PetInfo_One_exec(data.CatchTime, func(t *model.PetEX) {
c.Info.PetList = append(c.Info.PetList, t.Data)
result.PetInfo = t.Data
})
}
if len(c.Info.PetList) > 0 {