Files
bl/modules/blazing/service/effect.go

39 lines
738 B
Go
Raw Normal View History

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()