cancel accept
This commit is contained in:
@@ -317,6 +317,9 @@ func CancelAcceptJob(ctx *jxcontext.Context, jobID int, jobOrderID int64) (err e
|
||||
jobOrder := &model.JobOrder{}
|
||||
jobOrder.JobOrderID = jobOrderID
|
||||
err = dao.GetEntity(db, jobOrder, "JobOrderID")
|
||||
if jobOrder.ID != 0 && jobOrder.Status == model.JobOrderStatusCancel {
|
||||
return fmt.Errorf("此任务已被取消了!")
|
||||
}
|
||||
job := &model.Job{}
|
||||
job.ID = jobID
|
||||
err = dao.GetEntity(db, job)
|
||||
@@ -345,13 +348,13 @@ func CancelAcceptJob(ctx *jxcontext.Context, jobID int, jobOrderID int64) (err e
|
||||
dao.Rollback(db)
|
||||
return err
|
||||
}
|
||||
}
|
||||
//3、任务订单状态被取消
|
||||
jobOrder.Status = model.JobOrderStatusCancel
|
||||
if _, err = dao.UpdateEntity(db, jobOrder, "Status"); err != nil {
|
||||
dao.Rollback(db)
|
||||
return err
|
||||
}
|
||||
}
|
||||
dao.Commit(db)
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user