feat(go): 升级 Go 版本至 1.20

统一将所有模块的 Go 版本从 1.18 或 1.19 升级到 1.20,以使用最新的语言特性和性能改进。

feat(service): 新增乱斗服务默认宠物生成逻辑

在 fight 模块中调用新的 MELEEService.Def() 方法来生成初始对战宠物,
并根据配置
This commit is contained in:
2025-12-15 14:26:24 +08:00
parent 78bb2bd148
commit 937f97fe83
19 changed files with 79 additions and 32 deletions

View File

@@ -32,7 +32,7 @@ type MeleeConfig struct {
Nature uint32 `gorm:"not null;default:0;comment:'BOSS属性-性格'" json:"nature"`
SKill []uint32 `gorm:"type:jsonb;not null;default:'[]';comment:'BOSS技能'" json:"skill"`
Effect []uint32 `gorm:"type:jsonb;not null;default:'[]';comment:'BOSS特性'" json:"effect"`
Color string `gorm:"not null;default:'0';comment:'BOSS颜色'" json:"color"`
Color *string `gorm:"comment:'BOSS颜色'" json:"color"`
IsEnable uint32 `gorm:"not null;default:0;comment:'是否启用'" json:"is_enable"`
// ISMELEE uint32 `gorm:"not null;default:0;comment:'是否乱斗配置'" json:"is_melee"`
@@ -82,10 +82,7 @@ type MeleeConfig struct {
// MeleeConfigEX 扩展BOSS配置模型用于前端/业务层的数组格式解析)
type MeleeConfigEX struct {
MeleeConfig
Color GlowFilter `json:"color"`
ISboss uint32 `gorm:"not null;default:0;comment:'是否是Boss'" json:"is_boss"`
ISgift uint32 `gorm:"not null;default:0;comment:'是否是礼物'" json:"is_gif"`
Color *GlowFilter `json:"color"`
}
// TableName 指定MeleeConfig对应的数据库表名

View File

@@ -16,3 +16,14 @@ func NewMELEEService() *MELEEService {
},
}
}
func (s *MELEEService) Def() []model.MeleeConfigEX {
var pets []model.MeleeConfigEX
m := cool.DBM(s.Model)
m.OrderRandom().Limit(3).Scan(&pets)
return pets
// return ret.Interface().([]model.PetFusion)
}

View File

@@ -49,10 +49,10 @@ func (s *PetFusionMaterialService) Data(Material1 [4]uint32) uint32 {
var effect *model.PetFusionMaterial //一个特性应该是唯一的,但是我们要获取默认随机特性
condition := g.Map{
"material1": fusions[Material1[0]].ID,
"material2": fusions[Material1[1]].ID,
"material3": fusions[Material1[2]].ID,
"material4": fusions[Material1[3]].ID,
"material1": Material1[0],
"material2": Material1[1],
"material3": Material1[2],
"material4": Material1[3],
"is_enable": 1,
}
m.Where(condition).Cache(gdb.CacheOption{

View File

@@ -1,6 +1,6 @@
module blazing/modules/dict
go 1.18
go 1.20
require github.com/gogf/gf/v2 v2.8.0

View File

@@ -1,6 +1,6 @@
module blazing/modules
go 1.19
go 1.20
require (
)

View File

@@ -1,6 +1,6 @@
module blazing/modules/space
go 1.18
go 1.20
require github.com/gogf/gf/v2 v2.8.0

View File

@@ -1,6 +1,6 @@
module blazing/modules/task
go 1.18
go 1.20
require (
github.com/gogf/gf/v2 v2.8.0