All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
将地图热度信息从简单的计数器改为包含提示信息的结构体 添加矿物、BOSS、宠物和掉落等提示信息的收集功能 优化地图进入和离开时的计数逻辑
46 lines
984 B
Go
46 lines
984 B
Go
package service
|
|
|
|
import (
|
|
"blazing/cool"
|
|
"blazing/modules/config/model"
|
|
|
|
"github.com/samber/lo"
|
|
)
|
|
|
|
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) []uint32 {
|
|
|
|
var pet []model.MapPit //一个特性应该是唯一的,但是我们要获取默认随机特性
|
|
dbm_enable(s.Model).Where("map_id", mapid).Scan(&pet)
|
|
var ret []uint32
|
|
for _, v := range pet {
|
|
|
|
ret = append(ret, v.RefreshID...)
|
|
}
|
|
|
|
return lo.Union(ret)
|
|
|
|
}
|