diff --git a/client.go b/client.go index b26ca3e..904fb94 100644 --- a/client.go +++ b/client.go @@ -77,6 +77,7 @@ func NewClient(config *ClientConfig) (*Client, error) { c.config.debug = config.Debug + // 配置外网ip if config.CurrentIp == "" { config.CurrentIp = goip.GetOutsideIp(ctx) } @@ -84,7 +85,11 @@ func NewClient(config *ClientConfig) (*Client, error) { c.config.systemOutsideIp = config.CurrentIp } - // 缓存 + if c.config.debug { + log.Printf("[gojobs]配置外网ip成功:%+v\n", c.config.systemOutsideIp) + } + + // 配置缓存 redisClient := config.RedisClientFun() if redisClient != nil && redisClient.Db != nil { c.cache.redisClient = redisClient @@ -93,16 +98,28 @@ func NewClient(config *ClientConfig) (*Client, error) { return nil, redisPrefixFunNoConfig } - // 缓存前缀 + if c.config.debug { + log.Printf("[gojobs]配置缓存成功:%+v\n", c.cache) + } + + // 配置缓存前缀 c.cache.lockKeyPrefix, c.cache.lockKeySeparator, c.cache.cornKeyPrefix, c.cache.cornKeyCustom = config.RedisPrefixFun() if c.cache.lockKeyPrefix == "" || c.cache.lockKeySeparator == "" || c.cache.cornKeyPrefix == "" || c.cache.cornKeyCustom == "" { return nil, redisPrefixFunNoConfig } + if c.config.debug { + log.Printf("[gojobs]配置缓存前缀成功:%+v\n", c.cache) + } + // 配置信息 c.setConfig(ctx) - // 数据库 + if c.config.debug { + log.Printf("[gojobs]配置信息成功:%+v\n", c.config) + } + + // 配置关系数据库 gormClient := config.GormClientFun() if gormClient != nil && gormClient.Db != nil { c.db.gormClient = gormClient @@ -112,7 +129,11 @@ func NewClient(config *ClientConfig) (*Client, error) { return nil, gormClientFunNoConfig } - // 数据库 + if c.config.debug { + log.Printf("[gojobs]配置关系数据库成功:%+v\n", c.db) + } + + // 配置非关系数据库 mongoClient, databaseName := config.MongoClientFun() if mongoClient != nil && mongoClient.Db != nil { c.db.mongoClient = mongoClient @@ -128,7 +149,11 @@ func NewClient(config *ClientConfig) (*Client, error) { } if c.config.debug { - log.Printf("[gojobs]:%+v\n", c) + log.Printf("[gojobs]配置非关系数据库成功:%+v\n", c.db) + } + + if c.config.debug { + log.Printf("[gojobs]创建实例成功:%+v\n", c) } return c, nil diff --git a/const.go b/const.go index 12d3801..638a8a2 100644 --- a/const.go +++ b/const.go @@ -1,6 +1,6 @@ package gojobs const ( - Version = "1.0.87" + Version = "1.0.88" SpecifyIpNull = "0.0.0.0" ) diff --git a/jobs_xorm_model/task_ip.go b/jobs_xorm_model/task_ip.go deleted file mode 100644 index 30abd02..0000000 --- a/jobs_xorm_model/task_ip.go +++ /dev/null @@ -1,12 +0,0 @@ -package jobs_xorm_model - -// TaskIp 任务Ip -type TaskIp struct { - Id int64 `xorm:"pk autoincr" json:"id"` - TaskType string `json:"task_type"` // 任务编号 - Ips string `json:"ips"` // 任务IP -} - -func (TaskIp) TableName() string { - return "task_ip" -} diff --git a/jobs_xorm_model/task_log.go b/jobs_xorm_model/task_log.go deleted file mode 100644 index 3c2dfd3..0000000 --- a/jobs_xorm_model/task_log.go +++ /dev/null @@ -1,15 +0,0 @@ -package jobs_xorm_model - -// TaskLog 任务日志模型 -type TaskLog struct { - Id uint `xorm:"pk autoincr" json:"id"` // 记录编号 - TaskId uint `json:"task_id"` // 任务编号 - StatusCode int `json:"status_code"` // 状态码 - Desc string `json:"desc"` // 结果 - Version int `json:"version"` // 版本 - CreatedAt string `xorm:"created" json:"created_at"` // 创建时间 -} - -func (TaskLog) TableName() string { - return "task_log" -} diff --git a/jobs_xorm_model/task_log_run.go b/jobs_xorm_model/task_log_run.go deleted file mode 100644 index dff560f..0000000 --- a/jobs_xorm_model/task_log_run.go +++ /dev/null @@ -1,21 +0,0 @@ -package jobs_xorm_model - -// TaskLogRun 任务执行日志模型 -type TaskLogRun struct { - Id uint `xorm:"pk autoincr" json:"id"` // 记录编号 - TaskId uint `json:"task_id"` // 任务编号 - RunId string `json:"run_id"` // 执行编号 - OutsideIp string `json:"outside_ip"` // 外网ip - InsideIp string `json:"inside_ip"` // 内网ip - Os string `json:"os"` // 系统类型 - Arch string `json:"arch"` // 系统架构 - Gomaxprocs int `json:"gomaxprocs"` // CPU核数 - GoVersion string `json:"go_version"` // GO版本 - SdkVersion string `json:"sdk_version"` // SDK版本 - MacAddrs string `json:"mac_addrs"` // Mac地址 - CreatedAt string `xorm:"created" json:"created_at"` // 创建时间 -} - -func (TaskLogRun) TableName() string { - return "task_log_run" -}