All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
feat(fight): 使用专用函数构建战斗结束数据包 为战斗结束消息创建专用的构建函数, 统一处理战斗结束信息的数据包构建逻辑, 提高代码的一致性和可维护性。 fix(config): 优化数据库查询语句以提高性能 将数组包含操作(@>)替换为 ANY 操作符, 在 Egg、MapPit、PetFusion 等服务中使用更高效 的查询方式
49 lines
1.1 KiB
Go
49 lines
1.1 KiB
Go
package service
|
|
|
|
import (
|
|
"blazing/cool"
|
|
"blazing/modules/config/model"
|
|
)
|
|
|
|
type MapPitService struct {
|
|
*cool.Service
|
|
}
|
|
|
|
func NewMapPitService() *MapPitService {
|
|
return &MapPitService{
|
|
&cool.Service{
|
|
Model: model.NewMapPit(),
|
|
PageQueryOp: &cool.QueryOp{
|
|
KeyWordField: []string{"remake"},
|
|
FieldEQ: []string{"map_id"},
|
|
},
|
|
},
|
|
}
|
|
}
|
|
|
|
// func (s *MapPitService) GetData(mapid, pos uint32) []model.MapPit {
|
|
|
|
// var pet []model.MapPit //一个特性应该是唯一的,但是我们要获取默认随机特性
|
|
// dbm_enable(s.Model).Where("map_id", mapid).Wheref(`pos @> ARRAY[?]::integer[]`, pos).Scan(&pet)
|
|
|
|
// return pet
|
|
|
|
// }
|
|
func (s *MapPitService) GetDataALL(mapid uint32) []model.MapPit {
|
|
|
|
var pet []model.MapPit //一个特性应该是唯一的,但是我们要获取默认随机特性
|
|
dbm_enable(s.Model).Where("map_id", mapid).Scan(&pet)
|
|
|
|
return pet
|
|
|
|
}
|
|
|
|
func (s *MapPitService) GetPet(petid uint32) []model.MapPit {
|
|
|
|
var pet []model.MapPit //一个特性应该是唯一的,但是我们要获取默认随机特性
|
|
dbm_enable(s.Model).Wheref(`? = ANY(refresh_id)`, petid).Scan(&pet)
|
|
|
|
return pet
|
|
|
|
}
|