- update api ip

master v1.0.71
李光春 2 years ago
parent a9ae30ac48
commit b2786dcae5

@ -20,6 +20,7 @@ type ApiGormClientConfig struct {
GormClientFun apiGormClientFun // 日志配置
Debug bool // 日志开关
ZapLog *ZapLog // 日志服务
CurrentIp string // 当前ip
}
// NewApiGormClient 创建接口实例化
@ -35,6 +36,13 @@ func NewApiGormClient(config *ApiGormClientConfig) (*ApiClient, error) {
c.logDebug = config.Debug
if config.CurrentIp == "" {
config.CurrentIp = goip.GetOutsideIp(ctx)
}
if config.CurrentIp != "" && config.CurrentIp != "0.0.0.0" {
c.currentIp = config.CurrentIp
}
client, tableName := config.GormClientFun()
if client == nil || client.Db == nil {

@ -21,6 +21,7 @@ type ApiMongoClientConfig struct {
MongoClientFun apiMongoClientFun // 日志配置
Debug bool // 日志开关
ZapLog *ZapLog // 日志服务
CurrentIp string // 当前ip
}
// NewApiMongoClient 创建接口实例化
@ -37,6 +38,13 @@ func NewApiMongoClient(config *ApiMongoClientConfig) (*ApiClient, error) {
c.logDebug = config.Debug
if config.CurrentIp == "" {
config.CurrentIp = goip.GetOutsideIp(ctx)
}
if config.CurrentIp != "" && config.CurrentIp != "0.0.0.0" {
c.currentIp = config.CurrentIp
}
client, databaseName, collectionName := config.MongoClientFun()
if client == nil || client.Db == nil {

@ -1,5 +1,5 @@
package golog
const (
Version = "1.0.70"
Version = "1.0.71"
)

Loading…
Cancel
Save