```
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

feat(controller): 增强命令注册逻辑并修复试炼塔关卡限制

- 在命令注册时检查重复方法,如果存在则panic提示错误
- 移除CurrentFreshStage和CurrentStage的默认值设置逻辑
- 添加关卡等级验证,确保用户不能挑战超过最大关卡数的关卡
- 修复试炼之塔和勇者之塔的关卡计算逻辑

fix(item): 修复道具
This commit is contained in:
昔念
2026-03-03 19:28:59 +08:00
parent 103bc0c232
commit 5caa9a1e4f
10 changed files with 98 additions and 36 deletions

View File

@@ -98,10 +98,14 @@ func Init(isGame bool) {
cmdInfo.NewReqFunc = func() interface{} {
return reflect.New(reqType).Interface()
}
cool.CmdCache[cmd] = cmdInfo
// if exists { // 方法已存在
// glog.Error(context.Background(), "命令处理方法已存在,跳过注册", cmd, method.Name)
// }
_, exists := cool.CmdCache[cmd]
if exists { // 方法已存在
panic(fmt.Sprintf("命令处理方法已存在,跳过注册 %d %s", cmd, method.Name))
} else {
cool.CmdCache[cmd] = cmdInfo
}
}
}
}