fix: 修复日志格式化字符串错误和任务奖励逻辑
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
xinian
2026-04-10 10:28:22 +08:00
parent 061e4f0c51
commit 0daeb70900
6 changed files with 68 additions and 149 deletions

View File

@@ -56,29 +56,24 @@ func (p *Player) TawerCompletedTask(taskID int, ot int) {
}
// 处理指定分支ot仅奖励存在时才标记分支完成并发奖
p.Service.Task.Exec(uint32(taskID), func(te *model.Task) bool {
taskData, err := p.Service.Task.GetTask(uint32(taskID))
if err != nil {
return
}
// 核心检查:指定分支的奖励是否存在
branchGift := p.getTaskGift(taskID, ot)
if branchGift == nil {
return false
}
// 核心检查:指定分支的奖励是否存在
branchGift := p.getTaskGift(taskID, ot)
if branchGift == nil {
return
}
// 初始化分支数据
if te.Data == nil {
te.Data = []uint32{}
}
r := bitset32.From(te.Data)
// 分支未完成时,标记完成并发放奖励
if !r.Test(uint(ot)) {
r.Set(uint(ot))
p.bossgive(taskID, ot)
te.Data = r.Bytes()
return true
}
return false
})
r := bitset32.From(taskData.Data)
if !r.Test(uint(ot)) {
r.Set(uint(ot))
p.bossgive(taskID, ot)
taskData.Data = r.Bytes()
_ = p.Service.Task.SetTask(taskData)
}
}
// bossgive 发放任务奖励(逻辑保持不变,仅补充注释)