fix: 修复日志格式化字符串错误和任务奖励逻辑
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
This commit is contained in:
@@ -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 发放任务奖励(逻辑保持不变,仅补充注释)
|
||||
|
||||
Reference in New Issue
Block a user