All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
将地图热度信息从简单的计数器改为包含提示信息的结构体 添加矿物、BOSS、宠物和掉落等提示信息的收集功能 优化地图进入和离开时的计数逻辑
43 lines
788 B
Go
43 lines
788 B
Go
package service
|
|
|
|
import (
|
|
"blazing/cool"
|
|
"blazing/modules/config/model"
|
|
|
|
"github.com/samber/lo"
|
|
)
|
|
|
|
type TalkConfigService struct {
|
|
*cool.Service
|
|
}
|
|
|
|
func NewTalkConfigService() *TalkConfigService {
|
|
return &TalkConfigService{
|
|
|
|
Service: &cool.Service{Model: model.NewMineralCollectionConfig()},
|
|
// Cache: gcache.New()},
|
|
}
|
|
|
|
}
|
|
|
|
func (s *TalkConfigService) GetCache(flag int) model.MineralCollectionConfig {
|
|
|
|
var config model.MineralCollectionConfig
|
|
dbm_enable(s.Model).Where("type", flag).Scan(&config)
|
|
return config
|
|
|
|
}
|
|
|
|
func (s *TalkConfigService) GetTip(mapid uint32) []uint32 {
|
|
var item []model.TaskConfig
|
|
dbm_enable(s.Model).Where("map_id", mapid).Scan(&item)
|
|
var res []uint32
|
|
for _, v := range item {
|
|
res = append(res, v.ItemRewardIds...)
|
|
|
|
}
|
|
|
|
return lo.Union(res)
|
|
|
|
}
|