提交战斗系统
This commit is contained in:
@@ -31,46 +31,6 @@ func (s *TaskService) Exec(t func(map[uint32]model.TaskInfo) bool) (ret bool) {
|
||||
s.GetModel().Save(&tt) //退出时保存
|
||||
return
|
||||
}
|
||||
func (s *TaskService) AcceptTask(task uint32) (ret bool) {
|
||||
|
||||
s.Exec(func(ttt map[uint32]model.TaskInfo) bool {
|
||||
ft, ok := ttt[task]
|
||||
if ok { //如果找到任务
|
||||
if ft.Status == 0 { //可以接受
|
||||
ft.Status = 1
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
} else {
|
||||
ttt[task] = model.TaskInfo{
|
||||
Status: 1,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return false
|
||||
})
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新任务步骤
|
||||
*/
|
||||
func (s *TaskService) AddTaskBuf(task uint32, info model.TaskInfo) bool {
|
||||
|
||||
return s.Exec(func(ttt map[uint32]model.TaskInfo) bool {
|
||||
if conditions, ok := ttt[task]; ok {
|
||||
conditions.TaskInfo = info.TaskInfo
|
||||
ttt[task] = conditions
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 完成任务
|
||||
|
||||
Reference in New Issue
Block a user