2025-12-08 00:17:04 +08:00
|
|
|
package service
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"blazing/cool"
|
|
|
|
|
"blazing/modules/blazing/model"
|
2025-12-08 19:31:59 +08:00
|
|
|
"context"
|
|
|
|
|
|
|
|
|
|
"github.com/gogf/gf/v2/os/gcache"
|
2025-12-08 00:17:04 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type EffectService struct {
|
|
|
|
|
*cool.Service
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (s *EffectService) Args(id uint32) (int, []int) {
|
2025-12-08 19:31:59 +08:00
|
|
|
ret, _ := s.Cache.GetOrSetFuncLock(context.Background(), id, func(context.Context) (interface{}, error) {
|
2025-12-08 00:17:04 +08:00
|
|
|
|
2025-12-08 19:31:59 +08:00
|
|
|
m := cool.DBM(s.Model).Where("se_idx", id)
|
|
|
|
|
var tt model.PlayerPetSpecialEffect
|
2025-12-09 11:19:15 +08:00
|
|
|
m.Scan(&tt)
|
|
|
|
|
|
2025-12-08 19:31:59 +08:00
|
|
|
return tt, nil
|
|
|
|
|
}, 0)
|
|
|
|
|
tt := ret.Interface().(model.PlayerPetSpecialEffect)
|
2025-12-08 00:17:04 +08:00
|
|
|
|
2025-12-08 19:31:59 +08:00
|
|
|
return int(tt.Eid), tt.Args
|
2025-12-08 00:17:04 +08:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
func NewEffectService() *EffectService {
|
|
|
|
|
return &EffectService{
|
|
|
|
|
&cool.Service{
|
2025-12-08 19:31:59 +08:00
|
|
|
Cache: gcache.New(),
|
2025-12-08 00:17:04 +08:00
|
|
|
Model: model.NewPlayerPetSpecialEffect(),
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-12-08 19:50:54 +08:00
|
|
|
|
|
|
|
|
var Effects = NewEffectService()
|