Files
bl/modules/blazing/service/effect.go
昔念 2633402b52 fix(fight_boss): 修复 boss 战斗中索引为 0 的异常处理逻辑
当 effect 索引为 0 时,跳过无效处理以避免潜在错误。

feat(task): 更新任务奖励与注册参数配置

- 移除任务 37 中的注释项并保留有效奖励
- 修改任务 91 注册参数为 246
- 清空任务 300 的物品奖励列表,并设置类型为 30

refactor(fight_input): 优化 meetpet 初始化条件判断

将多个判断条件拆分为独立 if 判断语句,提高代码可读性。

refactor(effect_service): 移除 Scan 错误检查冗余逻辑

简化数据库查询后的错误处理流程,提升
2025-12-09 11:19:15 +08:00

39 lines
738 B
Go

package service
import (
"blazing/cool"
"blazing/modules/blazing/model"
"context"
"github.com/gogf/gf/v2/os/gcache"
)
type EffectService struct {
*cool.Service
}
func (s *EffectService) Args(id uint32) (int, []int) {
ret, _ := s.Cache.GetOrSetFuncLock(context.Background(), id, func(context.Context) (interface{}, error) {
m := cool.DBM(s.Model).Where("se_idx", id)
var tt model.PlayerPetSpecialEffect
m.Scan(&tt)
return tt, nil
}, 0)
tt := ret.Interface().(model.PlayerPetSpecialEffect)
return int(tt.Eid), tt.Args
}
func NewEffectService() *EffectService {
return &EffectService{
&cool.Service{
Cache: gcache.New(),
Model: model.NewPlayerPetSpecialEffect(),
},
}
}
var Effects = NewEffectService()