正在显示
1 个修改的文件
包含
26 行增加
和
0 行删除
@@ -1011,7 +1011,33 @@ func (taskService *TaskService) GetTask(getTaskQuery *query.GetTaskQuery) (inter | @@ -1011,7 +1011,33 @@ func (taskService *TaskService) GetTask(getTaskQuery *query.GetTaskQuery) (inter | ||
1011 | 1011 | ||
1012 | // 更新过期任务状态 | 1012 | // 更新过期任务状态 |
1013 | func (taskService *TaskService) UpdateTaskStatus() (interface{}, error) { | 1013 | func (taskService *TaskService) UpdateTaskStatus() (interface{}, error) { |
1014 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
1015 | + if err != nil { | ||
1016 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
1017 | + } | ||
1018 | + if err := transactionContext.StartTransaction(); err != nil { | ||
1019 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
1020 | + } | ||
1021 | + defer func() { | ||
1022 | + transactionContext.RollbackTransaction() | ||
1023 | + }() | ||
1014 | 1024 | ||
1025 | + var taskDao *dao.TaskDao | ||
1026 | + if value, err := factory.CreateTaskDao(map[string]interface{}{ | ||
1027 | + "transactionContext": transactionContext, | ||
1028 | + }); err != nil { | ||
1029 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
1030 | + } else { | ||
1031 | + taskDao = value | ||
1032 | + } | ||
1033 | + | ||
1034 | + if err := taskDao.UpdateExpiredPlannedCompletionTimeBidTask(); err != nil { | ||
1035 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
1036 | + } | ||
1037 | + | ||
1038 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
1039 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
1040 | + } | ||
1015 | return nil, nil | 1041 | return nil, nil |
1016 | } | 1042 | } |
1017 | 1043 |
-
请 注册 或 登录 后发表评论