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