feat(config): 完善特效服务配置 - 添加UniqueKey字段配置索引唯一性校验 - 配置PageQueryOp支持关键词搜索功能 - 设置关键词搜索字段为desc描述字段 ```
38 lines
697 B
Go
38 lines
697 B
Go
package service
|
|
|
|
import (
|
|
"blazing/cool"
|
|
"blazing/modules/config/model"
|
|
|
|
"github.com/gogf/gf/v2/database/gdb"
|
|
)
|
|
|
|
type EffectService struct {
|
|
*cool.Service
|
|
}
|
|
|
|
func (s *EffectService) Args(id uint32) (int, []int) {
|
|
m := cool.DBM(s.Model).Where("se_idx", id).Cache(gdb.CacheOption{
|
|
//Duration: time.Hour,
|
|
|
|
Force: false,
|
|
})
|
|
var tt model.PlayerPetSpecialEffect
|
|
m.Scan(&tt)
|
|
|
|
return int(tt.Eid), tt.Args
|
|
|
|
}
|
|
func NewEffectService() *EffectService {
|
|
return &EffectService{
|
|
&cool.Service{
|
|
|
|
Model: model.NewPlayerPetSpecialEffect(),
|
|
UniqueKey: map[string]string{"idx_se_idx": "索引不能重复"},
|
|
PageQueryOp: &cool.QueryOp{
|
|
KeyWordField: []string{"desc"},
|
|
},
|
|
},
|
|
}
|
|
}
|