feat(fight): 新增团战胜利关闭和超时退出功能

新增 GroupFightWinClose 和 GroupFightTimeoutExit 方法,
用于处理团战胜利关闭和超时退出逻辑,统一调用 QuitFight() 退出战斗。

fix(gold_list): 修复挂单服务中的逻辑错误和潜在异常

修复了 GoldListService 中的多处问题:
- 修正条件判断语句格式
- 添加数据库查询错误检查
- 优化
This commit is contained in:
昔念
2026-04-10 01:55:13 +08:00
parent 487ee0e726
commit 5c76aa7079
3 changed files with 36 additions and 6 deletions

View File

@@ -74,6 +74,20 @@ func (h Controller) GroupEscape(data *GroupEscapeInboundInfo, c *player.Player)
return nil, 0
}
func (h Controller) GroupFightWinClose(data *GroupFightWinCloseInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) {
if c != nil {
c.QuitFight()
}
return nil, -1
}
func (h Controller) GroupFightTimeoutExit(data *GroupFightTimeoutExitInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) {
if c != nil {
c.QuitFight()
}
return nil, -1
}
// UseSkill 使用技能包
func (h Controller) UseSkill(data *UseSkillInInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) {
if err := h.checkFightStatus(c); err != 0 {

View File

@@ -49,6 +49,14 @@ type GroupEscapeInboundInfo struct {
ActorIndex uint8
}
type GroupFightWinCloseInboundInfo struct {
Head common.TomeeHeader `cmd:"7574" struc:"skip"`
}
type GroupFightTimeoutExitInboundInfo struct {
Head common.TomeeHeader `cmd:"7587" struc:"skip"`
}
// EscapeFightInboundInfo 定义请求或响应数据结构。
type EscapeFightInboundInfo struct {
Head common.TomeeHeader `cmd:"2410" struc:"skip"`

View File

@@ -40,9 +40,17 @@ func (s *GoldListService) ModifyBefore(ctx context.Context, method string, param
}
} else {
var items []model.GoldBeanOrder
s.dbm_fix(s.Model).WhereIn("id", param["ids"]).Scan(&items)
if err = s.dbm_fix(s.Model).WhereIn("id", param["ids"]).Scan(&items); err != nil {
return err
}
for _, v := range items {
s.dbm_fix(s.Model).Where("rate", v.Rate, "exchange_num", v.ExchangeNum,"player_id", 10001).Delete()
if _, err = s.dbm_fix(s.Model).
Where("rate", v.Rate).
Where("exchange_num", v.ExchangeNum).
Where("player_id", 10001).
Delete(); err != nil {
return err
}
}
}