master v1.0.88
李光春 2 years ago
parent fbb4ccb197
commit 917a716c90

@ -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

@ -1,6 +1,6 @@
package gojobs
const (
Version = "1.0.87"
Version = "1.0.88"
SpecifyIpNull = "0.0.0.0"
)

@ -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"
}

@ -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"
}

@ -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"
}
Loading…
Cancel
Save