...
|
...
|
@@ -180,10 +180,12 @@ func (status *UnClaimedStatus) Rob(task *Task, receiver *EmployeeInfo) error { |
|
|
if task.TaskType != TASK_TYPE_ROB {
|
|
|
return fmt.Errorf("类型不符合的任务不允许抢单")
|
|
|
}
|
|
|
currentTime := time.Now()
|
|
|
task.RobInfo = &RobInfo{
|
|
|
Receiver: receiver,
|
|
|
ReceiveTime: time.Now(),
|
|
|
ReceiveTime: currentTime,
|
|
|
}
|
|
|
task.ReceiveTime = currentTime
|
|
|
task.TaskStatus = TASK_STATUS_UNDERWAY
|
|
|
task.CurrentStatus = &UnderwayStatus{}
|
|
|
return nil
|
...
|
...
|
@@ -193,10 +195,11 @@ func (status *UnClaimedStatus) Bib(task *Task, bidder *EmployeeInfo) error { |
|
|
if task.TaskType != TASK_TYPE_BID {
|
|
|
return fmt.Errorf("类型不符合的任务不允许竞标")
|
|
|
}
|
|
|
currentTime := time.Now()
|
|
|
if task.BidInfo == nil {
|
|
|
return fmt.Errorf("无效的竞标信息")
|
|
|
} else {
|
|
|
bidTime := time.Now()
|
|
|
bidTime := currentTime
|
|
|
if bidTime.Before(task.BidInfo.BidStartTime) {
|
|
|
return fmt.Errorf("竞标还没开始")
|
|
|
}
|
...
|
...
|
@@ -221,6 +224,7 @@ func (status *UnClaimedStatus) ChooseSuccessfulBidder(task *Task, successfulBidd |
|
|
winBidTime := time.Now()
|
|
|
task.BidInfo.SuccessfulBidder = successfulBidder
|
|
|
task.BidInfo.WinBidTime = winBidTime
|
|
|
task.ReceiveTime = winBidTime
|
|
|
task.TaskStatus = TASK_STATUS_UNDERWAY
|
|
|
task.CurrentStatus = &UnderwayStatus{}
|
|
|
return nil
|
...
|
...
|
@@ -265,6 +269,7 @@ func (status *UnderwayStatus) ChooseSuccessfulBidder(task *Task, successfulBidde |
|
|
|
|
|
func (status *UnderwayStatus) ApplyComplete(task *Task) error {
|
|
|
task.TaskStatus = TASK_STATUS_UNACCEPTANCE
|
|
|
task.CompleteTime = time.Now()
|
|
|
task.CurrentStatus = &UnAcceptanceStatus{}
|
|
|
return nil
|
|
|
}
|
...
|
...
|
@@ -327,6 +332,7 @@ func (status *UnAcceptanceStatus) Acceptance(task *Task, participators []*Employ |
|
|
}
|
|
|
}
|
|
|
task.TaskStatus = TASK_STATUS_COMPLETED
|
|
|
task.AcceptanceTime = time.Now()
|
|
|
task.CurrentStatus = &CompletedStatus{}
|
|
|
return nil
|
|
|
}
|
...
|
...
|
|