From 8e88606e9127c95f6f6be74c8819598f04910e11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=85=89=E6=98=A5?= Date: Wed, 31 Aug 2022 22:44:39 +0800 Subject: [PATCH] - update model --- const.go | 4 +++- jobs_gorm_model/task.go | 42 ++++++++++++++++++++--------------------- jobs_gorm_redis_get.go | 2 +- 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/const.go b/const.go index 292ea2f..7b125d6 100644 --- a/const.go +++ b/const.go @@ -1,3 +1,5 @@ package gojobs -const Version = "1.0.69" +const Version = "1.0.70" + +const SpecifyIpNull = "0.0.0.0" diff --git a/jobs_gorm_model/task.go b/jobs_gorm_model/task.go index 4e7adda..d144917 100644 --- a/jobs_gorm_model/task.go +++ b/jobs_gorm_model/task.go @@ -7,27 +7,27 @@ import ( // Task 任务 type Task struct { - Id uint `gorm:"primaryKey;comment:记录编号" json:"id"` // 记录编号 - Status string `gorm:"index;comment:状态码" json:"status"` // 状态码 - Params string `gorm:"comment:参数" json:"params"` // 参数 - ParamsType string `gorm:"comment:参数类型" json:"params_type"` // 参数类型 - StatusDesc string `gorm:"comment:状态描述" json:"status_desc"` // 状态描述 - Frequency int64 `gorm:"index;comment:频率(秒单位)" json:"frequency"` // 频率(秒单位) - Number int64 `gorm:"comment:当前次数" json:"number"` // 当前次数 - MaxNumber int64 `gorm:"comment:最大次数" json:"max_number"` // 最大次数 - RunId string `gorm:"index;comment:执行编号" json:"run_id"` // 执行编号 - CustomId string `gorm:"index;comment:自定义编号" json:"custom_id"` // 自定义编号 - CustomSequence int64 `gorm:"index;comment:自定义顺序" json:"custom_sequence"` // 自定义顺序 - Type string `gorm:"index;comment:类型" json:"type"` // 类型 - TypeName string `gorm:"comment:类型名称" json:"type_name"` // 类型名称 - CreatedIp string `gorm:"type:inet;comment:创建外网IP" json:"created_ip"` // 创建外网IP - SpecifyIp string `gorm:"type:inet;index;comment:指定外网IP" json:"specify_ip"` // 指定外网IP - UpdatedIp string `gorm:"type:inet;comment:更新外网IP" json:"updated_ip"` // 更新外网IP - Result string `gorm:"comment:结果" json:"result"` // 结果 - NextRunTime time.Time `gorm:"comment:下次运行时间" json:"next_run_time"` // 下次运行时间 - CreatedAt time.Time `gorm:"autoCreateTime;comment:创建时间" json:"created_at"` // 创建时间 - UpdatedAt time.Time `gorm:"autoUpdateTime;comment:更新时间" json:"updated_at"` // 更新时间 - DeletedAt gorm.DeletedAt `gorm:"index;comment:删除时间" json:"deleted_at"` // 删除时间 + Id uint `gorm:"primaryKey;comment:记录编号" json:"id"` // 记录编号 + Status string `gorm:"index;comment:状态码" json:"status"` // 状态码 + Params string `gorm:"comment:参数" json:"params"` // 参数 + ParamsType string `gorm:"comment:参数类型" json:"params_type"` // 参数类型 + StatusDesc string `gorm:"comment:状态描述" json:"status_desc"` // 状态描述 + Frequency int64 `gorm:"index;comment:频率(秒单位)" json:"frequency"` // 频率(秒单位) + Number int64 `gorm:"comment:当前次数" json:"number"` // 当前次数 + MaxNumber int64 `gorm:"comment:最大次数" json:"max_number"` // 最大次数 + RunId string `gorm:"index;comment:执行编号" json:"run_id"` // 执行编号 + CustomId string `gorm:"index;comment:自定义编号" json:"custom_id"` // 自定义编号 + CustomSequence int64 `gorm:"index;comment:自定义顺序" json:"custom_sequence"` // 自定义顺序 + Type string `gorm:"index;comment:类型" json:"type"` // 类型 + TypeName string `gorm:"comment:类型名称" json:"type_name"` // 类型名称 + CreatedIp string `gorm:"type:inet;default:0.0.0.0;comment:创建外网IP" json:"created_ip"` // 创建外网IP + SpecifyIp string `gorm:"type:inet;default:0.0.0.0;index;comment:指定外网IP" json:"specify_ip"` // 指定外网IP + UpdatedIp string `gorm:"type:inet;default:0.0.0.0;comment:更新外网IP" json:"updated_ip"` // 更新外网IP + Result string `gorm:"comment:结果" json:"result"` // 结果 + NextRunTime time.Time `gorm:"comment:下次运行时间" json:"next_run_time"` // 下次运行时间 + CreatedAt time.Time `gorm:"autoCreateTime;comment:创建时间" json:"created_at"` // 创建时间 + UpdatedAt time.Time `gorm:"autoUpdateTime;comment:更新时间" json:"updated_at"` // 更新时间 + DeletedAt gorm.DeletedAt `gorm:"index;comment:删除时间" json:"deleted_at"` // 删除时间 } func (m *Task) TableName() string { diff --git a/jobs_gorm_redis_get.go b/jobs_gorm_redis_get.go index fde1708..1db8750 100644 --- a/jobs_gorm_redis_get.go +++ b/jobs_gorm_redis_get.go @@ -26,7 +26,7 @@ func (j *JobsGorm) GetIssueAddress(ctx context.Context, workers []string, v *job ) // 赋值ip - if v.SpecifyIp != "" { + if v.SpecifyIp != "" && v.SpecifyIp != SpecifyIpNull { currentIp = v.SpecifyIp appointIpStatus = true }