|
|
|
@ -90,9 +90,12 @@ func (j *JobsGorm) Run(info jobs_gorm_model.Task, status int, desc string) {
|
|
|
|
|
log.Println("statusCreate", statusCreate.Error)
|
|
|
|
|
}
|
|
|
|
|
if status == 0 {
|
|
|
|
|
statusEdit := j.EditTask(j.db, info.Id).Select("run_id").Updates(jobs_gorm_model.Task{
|
|
|
|
|
RunId: gouuid.GetUuId(),
|
|
|
|
|
})
|
|
|
|
|
statusEdit := j.EditTask(j.db, info.Id).
|
|
|
|
|
Select("run_id", "updated_at").
|
|
|
|
|
Updates(jobs_gorm_model.Task{
|
|
|
|
|
RunId: gouuid.GetUuId(),
|
|
|
|
|
UpdatedAt: gotime.Current().Format(),
|
|
|
|
|
})
|
|
|
|
|
if statusEdit.RowsAffected == 0 {
|
|
|
|
|
log.Println("statusEdit", statusEdit.Error)
|
|
|
|
|
}
|
|
|
|
@ -151,9 +154,10 @@ func (j *JobsGorm) Run(info jobs_gorm_model.Task, status int, desc string) {
|
|
|
|
|
if info.Number+1 >= info.MaxNumber {
|
|
|
|
|
// 关闭执行
|
|
|
|
|
statusEdit := j.EditTask(j.db, info.Id).
|
|
|
|
|
Select("status").
|
|
|
|
|
Select("status", "updated_at").
|
|
|
|
|
Updates(jobs_gorm_model.Task{
|
|
|
|
|
Status: TASK_TIMEOUT,
|
|
|
|
|
Status: TASK_TIMEOUT,
|
|
|
|
|
UpdatedAt: gotime.Current().Format(),
|
|
|
|
|
})
|
|
|
|
|
if statusEdit.RowsAffected == 0 {
|
|
|
|
|
log.Println("statusEdit", statusEdit.Error)
|
|
|
|
@ -203,6 +207,8 @@ func (j *JobsGorm) CreateInCustomId(config *ConfigCreateInCustomId) error {
|
|
|
|
|
CreatedIp: j.outsideIp,
|
|
|
|
|
SpecifyIp: config.SpecifyIp,
|
|
|
|
|
UpdatedIp: j.outsideIp,
|
|
|
|
|
CreatedAt: gotime.Current().Format(),
|
|
|
|
|
UpdatedAt: gotime.Current().Format(),
|
|
|
|
|
})
|
|
|
|
|
if createStatus.RowsAffected == 0 {
|
|
|
|
|
return errors.New(fmt.Sprintf("创建[%s@%s]任务失败:%s", config.CustomId, config.Type, createStatus.Error))
|
|
|
|
@ -239,6 +245,8 @@ func (j *JobsGorm) CreateInCustomIdOnly(config *ConfigCreateInCustomIdOnly) erro
|
|
|
|
|
CreatedIp: j.outsideIp,
|
|
|
|
|
SpecifyIp: config.SpecifyIp,
|
|
|
|
|
UpdatedIp: j.outsideIp,
|
|
|
|
|
CreatedAt: gotime.Current().Format(),
|
|
|
|
|
UpdatedAt: gotime.Current().Format(),
|
|
|
|
|
})
|
|
|
|
|
if createStatus.RowsAffected == 0 {
|
|
|
|
|
return errors.New(fmt.Sprintf("创建[%s@%s]任务失败:%s", config.CustomId, config.Type, createStatus.Error))
|
|
|
|
@ -273,6 +281,8 @@ func (j *JobsGorm) CreateInCustomIdMaxNumber(config *ConfigCreateInCustomIdMaxNu
|
|
|
|
|
CreatedIp: j.outsideIp,
|
|
|
|
|
SpecifyIp: config.SpecifyIp,
|
|
|
|
|
UpdatedIp: j.outsideIp,
|
|
|
|
|
CreatedAt: gotime.Current().Format(),
|
|
|
|
|
UpdatedAt: gotime.Current().Format(),
|
|
|
|
|
})
|
|
|
|
|
if createStatus.RowsAffected == 0 {
|
|
|
|
|
return errors.New(fmt.Sprintf("创建[%s@%s]任务失败:%s", config.CustomId, config.Type, createStatus.Error))
|
|
|
|
@ -311,6 +321,8 @@ func (j *JobsGorm) CreateInCustomIdMaxNumberOnly(config *ConfigCreateInCustomIdM
|
|
|
|
|
CreatedIp: j.outsideIp,
|
|
|
|
|
SpecifyIp: config.SpecifyIp,
|
|
|
|
|
UpdatedIp: j.outsideIp,
|
|
|
|
|
CreatedAt: gotime.Current().Format(),
|
|
|
|
|
UpdatedAt: gotime.Current().Format(),
|
|
|
|
|
})
|
|
|
|
|
if createStatus.RowsAffected == 0 {
|
|
|
|
|
return errors.New(fmt.Sprintf("创建[%s@%s]任务失败:%s", config.CustomId, config.Type, createStatus.Error))
|
|
|
|
|