feat: 添加野怪查询指令及支持服务
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
This commit is contained in:
@@ -91,6 +91,38 @@ func (s *DictInfoService) GetData(types string) (data map[uint32]model.DictInfo)
|
||||
})
|
||||
return fusions
|
||||
|
||||
}
|
||||
func (s *DictInfoService) GetNameData(types string) (data map[string]model.DictInfo) {
|
||||
var (
|
||||
dictInfoModel = model.NewDictInfo()
|
||||
dictTypeModel = model.NewDictType()
|
||||
)
|
||||
// 如果typeData为空, 则返回空
|
||||
var ty *model.DictType
|
||||
mType := cool.DBM(dictTypeModel)
|
||||
mType.Where("key in (?)", types).Cache(gdb.CacheOption{
|
||||
// Duration: time.Hour,
|
||||
|
||||
Force: false,
|
||||
}).Scan(&ty)
|
||||
|
||||
// 如果typeData为空, 则返回空
|
||||
if ty == nil {
|
||||
return nil
|
||||
}
|
||||
m := cool.DBM(dictInfoModel)
|
||||
var ress []model.DictInfo
|
||||
m.Where("typeId", ty.ID).Cache(gdb.CacheOption{
|
||||
// Duration: time.Hour,
|
||||
|
||||
Force: false,
|
||||
}).Scan(&ress)
|
||||
fusions := utils.ToMap(ress, func(t model.DictInfo) string {
|
||||
|
||||
return t.Name //物品id转id
|
||||
})
|
||||
return fusions
|
||||
|
||||
}
|
||||
|
||||
// 获取物品的最大数限制
|
||||
|
||||
Reference in New Issue
Block a user