- ExportOrders
This commit is contained in:
@@ -103,6 +103,8 @@ type BaseTask struct {
|
||||
FailedJobCount int `json:"failedJobCount"`
|
||||
Status int `json:"status"`
|
||||
|
||||
NoticeMsg string `json:"noticeMsg"`
|
||||
|
||||
Result []interface{} `json:"-"`
|
||||
Children TaskList `json:"children"`
|
||||
Err error `json:"err"`
|
||||
@@ -257,6 +259,18 @@ func (t *BaseTask) SetParent(parentTask ITask) {
|
||||
t.parent = parentTask
|
||||
}
|
||||
|
||||
func (t *BaseTask) SetNoticeMsg(noticeMsg string) {
|
||||
t.locker.Lock()
|
||||
defer t.locker.Unlock()
|
||||
t.NoticeMsg = noticeMsg
|
||||
}
|
||||
|
||||
func (t *BaseTask) GetNoticeMsg() string {
|
||||
t.locker.RLock()
|
||||
defer t.locker.RUnlock()
|
||||
return t.NoticeMsg
|
||||
}
|
||||
|
||||
func AddChild(parentTask ITask, task ITask) ITask {
|
||||
if parentTask != nil {
|
||||
return parentTask.AddChild(task)
|
||||
@@ -311,6 +325,10 @@ func (t *BaseTask) run(taskHandler func()) {
|
||||
taskDesc := fmt.Sprintf("你的异步任务[%s],ID[%s],开始于:%s,结束于:%s,", t.Name, t.ID, utils.Time2Str(t.CreatedAt), utils.Time2Str(t.TerminatedAt))
|
||||
if t.Err == nil {
|
||||
content = fmt.Sprintf("%s执行%s", taskDesc, TaskStatusName[t.Status])
|
||||
noticeMsg := t.GetNoticeMsg()
|
||||
if noticeMsg != "" {
|
||||
content += ",通知消息:" + noticeMsg
|
||||
}
|
||||
} else {
|
||||
if t.Status == TaskStatusFinished {
|
||||
content = fmt.Sprintf("%s执行部分失败,%s", taskDesc, t.Err.Error())
|
||||
|
||||
Reference in New Issue
Block a user