2025-08-27 20:52:15 +00:00
|
|
|
package controller
|
|
|
|
|
|
|
|
|
|
import (
|
2025-08-28 21:35:56 +00:00
|
|
|
"blazing/common/data/socket"
|
2025-08-27 20:52:15 +00:00
|
|
|
"blazing/common/socket/errorcode"
|
|
|
|
|
"blazing/logic/service/task"
|
|
|
|
|
"blazing/modules/blazing/model"
|
|
|
|
|
"blazing/modules/blazing/service"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 接受任务
|
|
|
|
|
*/
|
2025-08-28 21:35:56 +00:00
|
|
|
func (h Controller) AcceptTask(data *task.AcceptTaskInboundInfo, c *socket.Player) (result *task.AcceptTaskOutboundInfo, err errorcode.ErrorCode) {
|
2025-08-30 00:36:08 +08:00
|
|
|
isdaliy := false
|
|
|
|
|
if data.Head.CMD != 2201 { //判断是每日任务
|
|
|
|
|
isdaliy = true
|
|
|
|
|
}
|
|
|
|
|
service.NewUserService(c.Info.UserID).TaskExec(func(ttt map[uint32]model.TaskInfo) bool {
|
|
|
|
|
ft, ok := ttt[data.TaskId]
|
|
|
|
|
if ok { //如果找到任务
|
|
|
|
|
if ft.Status == 0 { //可以接受
|
|
|
|
|
ft.Status = 1 //接受
|
|
|
|
|
return true
|
2025-08-28 02:27:14 +00:00
|
|
|
} else {
|
2025-08-30 00:36:08 +08:00
|
|
|
return false
|
2025-08-28 02:27:14 +00:00
|
|
|
}
|
2025-08-30 00:36:08 +08:00
|
|
|
} else {
|
|
|
|
|
ttt[data.TaskId] = model.TaskInfo{
|
|
|
|
|
Status: 1,
|
2025-08-28 19:17:03 +00:00
|
|
|
}
|
2025-08-28 02:27:14 +00:00
|
|
|
|
2025-08-30 00:36:08 +08:00
|
|
|
}
|
2025-08-27 20:52:15 +00:00
|
|
|
|
2025-08-30 00:36:08 +08:00
|
|
|
return false
|
|
|
|
|
}, isdaliy)
|
2025-08-28 19:17:03 +00:00
|
|
|
result = &task.AcceptTaskOutboundInfo{}
|
|
|
|
|
result.TaskId = data.TaskId
|
2025-08-27 20:52:15 +00:00
|
|
|
return result, 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 更新任务步骤
|
|
|
|
|
*/
|
2025-08-28 21:35:56 +00:00
|
|
|
func (h Controller) AddTaskBuf(data *task.AddTaskBufInboundInfo, c *socket.Player) (result *task.AddTaskBufOutboundInfo, err errorcode.ErrorCode) {
|
2025-08-30 00:36:08 +08:00
|
|
|
isdaliy := false
|
|
|
|
|
if data.Head.CMD != 2204 { //判断是每日任务
|
|
|
|
|
isdaliy = true
|
2025-08-28 19:17:03 +00:00
|
|
|
}
|
2025-08-30 00:36:08 +08:00
|
|
|
service.NewUserService(c.Info.UserID).TaskExec(func(ttt map[uint32]model.TaskInfo) bool {
|
|
|
|
|
if conditions, ok := ttt[data.TaskId]; ok {
|
|
|
|
|
conditions.TaskInfo = data.TaskList
|
|
|
|
|
ttt[data.TaskId] = conditions
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false
|
|
|
|
|
}, isdaliy)
|
2025-08-27 20:52:15 +00:00
|
|
|
|
|
|
|
|
return &task.AddTaskBufOutboundInfo{}, 0
|
|
|
|
|
}
|
2025-08-28 19:17:03 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 完成任务
|
|
|
|
|
*/
|
2025-08-28 21:35:56 +00:00
|
|
|
func (h Controller) Complete_Task(data *task.CompleteTaskInboundInfo, c *socket.Player) (result *task.CompleteTaskOutboundInfo, err errorcode.ErrorCode) {
|
2025-08-28 19:17:03 +00:00
|
|
|
|
|
|
|
|
if data.Head.CMD == 2202 { //判断不是每日任务
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return &task.CompleteTaskOutboundInfo{}, 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取任务状态
|
|
|
|
|
*/
|
2025-08-28 21:35:56 +00:00
|
|
|
func (h Controller) Get_Task_Buf(data *task.GetTaskBufInboundInfo, c *socket.Player) (result *task.GetTaskBufOutboundInfo, err errorcode.ErrorCode) {
|
2025-08-30 00:36:08 +08:00
|
|
|
// isdaliy := false
|
|
|
|
|
// if data.Head.CMD != 2203 { //判断是每日任务
|
|
|
|
|
// isdaliy = true
|
|
|
|
|
// }
|
2025-08-28 19:17:03 +00:00
|
|
|
|
|
|
|
|
return &task.GetTaskBufOutboundInfo{}, 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 删除任务
|
|
|
|
|
*/
|
2025-08-28 21:35:56 +00:00
|
|
|
func (h Controller) Delete_Task(data *task.DeleteTaskInboundInfo, c *socket.Player) (result *task.DeleteTaskOutboundInfo, err errorcode.ErrorCode) {
|
2025-08-28 19:17:03 +00:00
|
|
|
|
|
|
|
|
if data.Head.CMD == 2205 { //判断不是每日任务
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return &task.DeleteTaskOutboundInfo{}, 0
|
|
|
|
|
}
|