fix(blazing): 修复宠物融合材料服务中数据获取逻辑错误
调整了缓存获取逻辑,忽略错误并优化返回值处理。 从 DictInfoService 获取的数据现在正确使用 Value 字段, 并且简化了随机属性索引的返回方式。
This commit is contained in:
@@ -46,7 +46,7 @@ func (s *PetFusionMaterialService) Data(Material1 [4]uint32) uint32 {
|
||||
}
|
||||
|
||||
}
|
||||
ret, err := s.Cache.GetOrSetFuncLock(context.Background(), cacheKey, func(context.Context) (interface{}, error) {
|
||||
ret, _ := s.Cache.GetOrSetFuncLock(context.Background(), cacheKey, func(context.Context) (interface{}, error) {
|
||||
|
||||
m := cool.DBM(s.Model)
|
||||
|
||||
@@ -65,25 +65,25 @@ func (s *PetFusionMaterialService) Data(Material1 [4]uint32) uint32 {
|
||||
return effect, nil
|
||||
}, 0)
|
||||
|
||||
effect2s := service.DictInfoServiceS.GetData("effect")
|
||||
effect := ret.Interface().(*model.PetFusionMaterial)
|
||||
|
||||
if err != nil {
|
||||
if effect == nil {
|
||||
effect2s := service.DictInfoServiceS.GetData("effect")
|
||||
for _, v := range effect2s {
|
||||
return gconv.Uint32(v.Remark)
|
||||
return gconv.Uint32(v.Value)
|
||||
}
|
||||
|
||||
}
|
||||
r := grand.Intn(4)
|
||||
switch r {
|
||||
case 0:
|
||||
return gconv.Uint32(effect2s[effect.Trait1Idx].Remark)
|
||||
return effect.Trait1Idx
|
||||
case 1:
|
||||
return gconv.Uint32(effect2s[effect.Trait2Idx].Remark)
|
||||
return effect.Trait2Idx
|
||||
case 2:
|
||||
return gconv.Uint32(effect2s[effect.Trait3Idx].Remark)
|
||||
return effect.Trait3Idx
|
||||
case 3:
|
||||
return gconv.Uint32(effect2s[effect.Trait4Idx].Remark)
|
||||
return effect.Trait4Idx
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user