feat(pet): 宠物治疗逻辑重构并新增治愈方法

将原有的宠物治疗逻辑提取为 PetInfo.Cure() 方法,统一处理血量和技能PP恢复。
同时优化经验分配逻辑,确保升级后正确扣除经验池并处理满级情况。

```
This commit is contained in:
2025-10-13 19:46:19 +08:00
parent 79213c67d6
commit 5e53b9caaa
5 changed files with 45 additions and 30 deletions

View File

@@ -2,10 +2,8 @@ package admin
import (
"blazing/cool"
"blazing/modules/blazing/model"
"blazing/modules/blazing/service"
"context"
"fmt"
"github.com/gogf/gf/v2/frame/g"
)
@@ -37,14 +35,14 @@ func init() {
}
func (c *PetBagController) GetSession(ctx context.Context, req *PetGetReq) (res *cool.BaseRes, err error) {
fmt.Println(req)
var (
admin = cool.GetAdmin(ctx)
//r = g.RequestFromCtx(ctx)
)
t := model.GenPetInfo(
req.PetTypeId, req.IndividualValue, req.NatureId, req.AbilityTypeEnum, req.IsShiny, req.Level)
service.NewUserService(uint32(admin.UserId)).PetAdd(*t)
// fmt.Println(req)
// var (
// admin = cool.GetAdmin(ctx)
// //r = g.RequestFromCtx(ctx)
// )
// t := model.GenPetInfo(
// req.PetTypeId, req.IndividualValue, req.NatureId, req.AbilityTypeEnum, req.IsShiny, req.Level)
// service.NewUserService(uint32(admin.UserId)).PetAdd(*t)
return
}