- update ip

master v1.0.97
李光春 2 years ago
parent d7a75aaac3
commit e015e8f77d

@ -72,6 +72,10 @@ func NewClient(config *ClientConfig) (*Client, error) {
c.config.systemOutsideIp = config.CurrentIp
}
if c.config.systemOutsideIp == "" {
return nil, currentIpNoConfig
}
if c.config.debug {
log.Printf("[gojobs]配置外网ip成功%+v\n", c.config.systemOutsideIp)
}

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

@ -8,7 +8,7 @@ require (
github.com/robfig/cron/v3 v3.0.1
go.dtapp.net/dorm v1.0.38
go.dtapp.net/goip v1.0.34
go.dtapp.net/golog v1.0.82
go.dtapp.net/golog v1.0.84
go.dtapp.net/gostring v1.0.10
go.dtapp.net/gotime v1.0.5
go.dtapp.net/gotrace_id v1.0.6

@ -520,8 +520,8 @@ go.dtapp.net/dorm v1.0.38 h1:9OgWY5bnar6D0Xdho62xn7RluXJNe8i7Kz/IeSUObF4=
go.dtapp.net/dorm v1.0.38/go.mod h1:z9ksZ4Y0HHH0odjEiG57d90/ZUBM51qXEWJC8fS+dEM=
go.dtapp.net/goip v1.0.34 h1:aW2CuPpQwcDOJiyx/gHbvrha3/x+poFRpDxsLtO4EVw=
go.dtapp.net/goip v1.0.34/go.mod h1:EctL6B8ue/kZKPr+kKZPU6YTTpNhihane9BHHffwo6Q=
go.dtapp.net/golog v1.0.82 h1:VSWaZLYjmtnI7h6cp9HGXrp+CVW+zS7Wii5kGd9sY88=
go.dtapp.net/golog v1.0.82/go.mod h1:4Pyx+hw4zul9DtHDuKRzBpVr30xnegEgZ/vK8GHBT04=
go.dtapp.net/golog v1.0.84 h1:o5sVo69f5y282YtJopfF9I+daJf8tkMMfXfocbMC4p8=
go.dtapp.net/golog v1.0.84/go.mod h1:y4ABAauy4T/Jvuh7kE8tIoa4H00NWmiUeazv0GZjhhA=
go.dtapp.net/gorandom v1.0.1 h1:IWfMClh1ECPvyUjlqD7MwLq4mZdUusD1qAwAdsvEJBs=
go.dtapp.net/gorandom v1.0.1/go.mod h1:ZPdgalKpvFV/ATQqR0k4ns/F/IpITAZpx6WkWirr5Y8=
go.dtapp.net/gorequest v1.0.31 h1:r/OoU5Y00TbJjkQtpvwjsb/pllqO0UQQjFRY1veZYZc=

@ -4,21 +4,21 @@ import "time"
// TaskLog 任务日志模型
type TaskLog struct {
LogId uint `gorm:"primaryKey;comment:日志编号" json:"log_id"` // 日志编号
TaskId uint `gorm:"index;comment:任务编号" json:"task_id"` // 任务编号
TaskRunId string `gorm:"comment:执行编号" json:"task_run_id"` // 执行编号
TaskResultCode int `gorm:"index;comment:执行状态码" json:"task_result_code"` // 执行状态码
TaskResultDesc string `gorm:"comment:执行结果" json:"task_result_desc"` // 执行结果
SystemHostName string `gorm:"comment:主机名" json:"system_host_name"` // 主机名
SystemInsideIp string `gorm:"comment:内网ip" json:"system_inside_ip"` // 内网ip
SystemOs string `gorm:"comment:系统类型" json:"system_os"` // 系统类型
SystemArch string `gorm:"comment:系统架构" json:"system_arch"` // 系统架构
GoVersion string `gorm:"comment:go版本" json:"go_version"` // go版本
SdkVersion string `gorm:"comment:sdk版本" json:"sdk_version"` // sdk版本
SystemOutsideIp string `gorm:"comment:外网ip" json:"system_outside_ip"` // 外网ip
LogTime time.Time `gorm:"autoCreateTime;comment:日志时间" json:"log_time"` // 日志时间
LogId uint `gorm:"primaryKey;comment:日志编号" json:"log_id"` // 日志编号
TaskId uint `gorm:"index;comment:任务编号" json:"task_id"` // 任务编号
TaskRunId string `gorm:"comment:执行编号" json:"task_run_id"` // 执行编号
TaskResultCode int `gorm:"index;comment:执行状态码" json:"task_result_code"` // 执行状态码
TaskResultDesc string `gorm:"comment:执行结果" json:"task_result_desc"` // 执行结果
SystemHostName string `gorm:"comment:主机名" json:"system_host_name"` // 主机名
SystemInsideIp string `gorm:"type:inet;default:0.0.0.0;comment:内网ip" json:"system_inside_ip"` // 内网ip
SystemOs string `gorm:"comment:系统类型" json:"system_os"` // 系统类型
SystemArch string `gorm:"comment:系统架构" json:"system_arch"` // 系统架构
GoVersion string `gorm:"comment:go版本" json:"go_version"` // go版本
SdkVersion string `gorm:"comment:sdk版本" json:"sdk_version"` // sdk版本
SystemOutsideIp string `gorm:"type:inet;default:0.0.0.0;comment:外网ip" json:"system_outside_ip"` // 外网ip
LogTime time.Time `gorm:"autoCreateTime;comment:日志时间" json:"log_time"` // 日志时间
}
func (m *TaskLog) TableName() string {
func (TaskLog) TableName() string {
return "task_log"
}

@ -3,6 +3,7 @@ package gojobs
import (
"context"
"go.dtapp.net/gojobs/jobs_gorm_model"
"go.dtapp.net/gotime"
)
// 创建模型
@ -20,3 +21,8 @@ func (c *Client) autoMigrateTaskLog(ctx context.Context) {
c.zapLog.WithTraceId(ctx).Sugar().Errorf("创建模型:%s", err)
}
}
// TaskLogDelete 删除
func (c *Client) TaskLogDelete(ctx context.Context, hour int64) error {
return c.gormClient.Db.Where("log_time < ?", gotime.Current().BeforeHour(hour).Format()).Delete(&jobs_gorm_model.TaskLog{}).Error
}

@ -6,3 +6,4 @@
*.log
gomod.sh
*_test.go
/vendor/

35
vendor/go.dtapp.net/golog/api.go generated vendored

@ -6,8 +6,6 @@ import (
"go.dtapp.net/dorm"
"go.dtapp.net/goip"
"go.dtapp.net/gorequest"
"os"
"runtime"
)
// ApiClientFun *ApiClient 驱动
@ -22,17 +20,18 @@ type ApiClient struct {
gormClient *dorm.GormClient // 数据库驱动
zapLog *ZapLog // 日志服务
logDebug bool // 日志开关
currentIp string // 当前ip
gormConfig struct {
tableName string // 表名
insideIp string // 内网ip
hostname string // 主机名
goVersion string // go版本
}
config struct {
os string // 系统类型
arch string // 系统架构
jsonStatus bool // json状态
systemHostName string // 主机名
systemInsideIp string // 内网ip
systemOs string // 系统类型
systemArch string // 系统架构
goVersion string // go版本
sdkVersion string // sdk版本
systemOutsideIp string // 外网ip
jsonStatus bool // json状态
}
}
@ -62,20 +61,19 @@ func NewApiClient(config *ApiClientConfig) (*ApiClient, error) {
config.CurrentIp = goip.GetOutsideIp(ctx)
}
if config.CurrentIp != "" && config.CurrentIp != "0.0.0.0" {
c.currentIp = config.CurrentIp
c.config.systemOutsideIp = config.CurrentIp
}
c.config.os = runtime.GOOS
c.config.arch = runtime.GOARCH
if c.config.systemOutsideIp == "" {
return nil, currentIpNoConfig
}
gormClient, gormTableName := config.GormClientFun()
if gormClient == nil || gormClient.Db == nil {
return nil, errors.New("没有设置驱动")
return nil, gormClientFunNoConfig
}
hostname, _ := os.Hostname()
if gormClient != nil || gormClient.Db != nil {
c.gormClient = gormClient
@ -90,12 +88,11 @@ func NewApiClient(config *ApiClientConfig) (*ApiClient, error) {
return nil, errors.New("创建表失败:" + err.Error())
}
c.gormConfig.hostname = hostname
c.gormConfig.insideIp = goip.GetInsideIp(ctx)
c.gormConfig.goVersion = runtime.Version()
}
// 配置信息
c.setConfig(ctx)
return c, nil
}

@ -10,8 +10,6 @@ import (
"go.dtapp.net/gotrace_id"
"go.dtapp.net/gourl"
"gorm.io/datatypes"
"os"
"runtime"
"unicode/utf8"
)
@ -41,13 +39,17 @@ func NewApiGormClient(config *ApiGormClientConfig) (*ApiClient, error) {
config.CurrentIp = goip.GetOutsideIp(ctx)
}
if config.CurrentIp != "" && config.CurrentIp != "0.0.0.0" {
c.currentIp = config.CurrentIp
c.config.systemOutsideIp = config.CurrentIp
}
if c.config.systemOutsideIp == "" {
return nil, currentIpNoConfig
}
client, tableName := config.GormClientFun()
if client == nil || client.Db == nil {
return nil, errors.New("没有设置驱动")
return nil, gormClientFunNoConfig
}
c.gormClient = client
@ -62,11 +64,8 @@ func NewApiGormClient(config *ApiGormClientConfig) (*ApiClient, error) {
return nil, errors.New("创建表失败:" + err.Error())
}
hostname, _ := os.Hostname()
c.gormConfig.hostname = hostname
c.gormConfig.insideIp = goip.GetInsideIp(ctx)
c.gormConfig.goVersion = runtime.Version()
// 配置信息
c.setConfig(ctx)
return c, nil
}
@ -94,16 +93,13 @@ func (c *ApiClient) gormRecord(ctx context.Context, data apiPostgresqlLogString)
data.ResponseBody = ""
}
data.SystemHostName = c.gormConfig.hostname
data.SystemInsideIp = c.gormConfig.insideIp
data.GoVersion = c.gormConfig.goVersion
data.SystemHostName = c.config.systemHostName
data.SystemInsideIp = c.config.systemInsideIp
data.GoVersion = c.config.goVersion
data.TraceId = gotrace_id.GetTraceIdContext(ctx)
data.RequestIp = c.currentIp
data.SystemOs = c.config.os
data.SystemArch = c.config.arch
data.RequestIp = c.config.systemOutsideIp
data.SystemOs = c.config.systemOs
data.SystemArch = c.config.systemArch
if c.config.jsonStatus {
err = c.gormClient.Db.Table(c.gormConfig.tableName).Create(&apiPostgresqlLogJson{

@ -7,25 +7,25 @@ import (
// 模型
type apiPostgresqlLogJson struct {
LogId uint `gorm:"primaryKey;comment:【记录】编号" json:"log_id,omitempty"` //【记录】编号
TraceId string `gorm:"index;comment:【系统】跟踪编号" json:"trace_id,omitempty"` //【系统】跟踪编号
RequestTime time.Time `gorm:"index;comment:【请求】时间" json:"request_time,omitempty"` //【请求】时间
RequestUri string `gorm:"comment:【请求】链接" json:"request_uri,omitempty"` //【请求】链接
RequestUrl string `gorm:"comment:【请求】链接" json:"request_url,omitempty"` //【请求】链接
RequestApi string `gorm:"index;comment:【请求】接口" json:"request_api,omitempty"` //【请求】接口
RequestMethod string `gorm:"index;comment:【请求】方式" json:"request_method,omitempty"` //【请求】方式
RequestParams datatypes.JSON `gorm:"type:jsonb;comment:【请求】参数" json:"request_params,omitempty"` //【请求】参数
RequestHeader datatypes.JSON `gorm:"type:jsonb;comment:【请求】头部" json:"request_header,omitempty"` //【请求】头部
RequestIp string `gorm:"index;comment:【请求】请求Ip" json:"request_ip,omitempty"` //【请求】请求Ip
ResponseHeader datatypes.JSON `gorm:"type:jsonb;comment:【返回】头部" json:"response_header,omitempty"` //【返回】头部
ResponseStatusCode int `gorm:"index;comment:【返回】状态码" json:"response_status_code,omitempty"` //【返回】状态码
ResponseBody datatypes.JSON `gorm:"type:jsonb;comment:【返回】数据" json:"response_content,omitempty"` //【返回】数据
ResponseContentLength int64 `gorm:"comment:【返回】大小" json:"response_content_length,omitempty"` //【返回】大小
ResponseTime time.Time `gorm:"index;comment:【返回】时间" json:"response_time,omitempty"` //【返回】时间
SystemHostName string `gorm:"index;comment:【系统】主机名" json:"system_host_name,omitempty"` //【系统】主机名
SystemInsideIp string `gorm:"index;comment:【系统】内网ip" json:"system_inside_ip,omitempty"` //【系统】内网ip
SystemOs string `gorm:"index;comment:【系统】系统类型" json:"system_os,omitempty"` //【系统】系统类型
SystemArch string `gorm:"index;comment:【系统】系统架构" json:"system_arch,omitempty"` //【系统】系统架构
GoVersion string `gorm:"comment:【程序】Go版本" json:"go_version,omitempty"` //【程序】Go版本
SdkVersion string `gorm:"comment:【程序】Sdk版本" json:"sdk_version,omitempty"` //【程序】Sdk版本
LogId uint `gorm:"primaryKey;comment:【记录】编号" json:"log_id,omitempty"` //【记录】编号
TraceId string `gorm:"index;comment:【系统】跟踪编号" json:"trace_id,omitempty"` //【系统】跟踪编号
RequestTime time.Time `gorm:"index;comment:【请求】时间" json:"request_time,omitempty"` //【请求】时间
RequestUri string `gorm:"comment:【请求】链接" json:"request_uri,omitempty"` //【请求】链接
RequestUrl string `gorm:"comment:【请求】链接" json:"request_url,omitempty"` //【请求】链接
RequestApi string `gorm:"index;comment:【请求】接口" json:"request_api,omitempty"` //【请求】接口
RequestMethod string `gorm:"index;comment:【请求】方式" json:"request_method,omitempty"` //【请求】方式
RequestParams datatypes.JSON `gorm:"type:jsonb;comment:【请求】参数" json:"request_params,omitempty"` //【请求】参数
RequestHeader datatypes.JSON `gorm:"type:jsonb;comment:【请求】头部" json:"request_header,omitempty"` //【请求】头部
RequestIp string `gorm:"type:inet;default:0.0.0.0;index;comment:【请求】请求Ip" json:"request_ip,omitempty"` //【请求】请求Ip
ResponseHeader datatypes.JSON `gorm:"type:jsonb;comment:【返回】头部" json:"response_header,omitempty"` //【返回】头部
ResponseStatusCode int `gorm:"index;comment:【返回】状态码" json:"response_status_code,omitempty"` //【返回】状态码
ResponseBody datatypes.JSON `gorm:"type:jsonb;comment:【返回】数据" json:"response_content,omitempty"` //【返回】数据
ResponseContentLength int64 `gorm:"comment:【返回】大小" json:"response_content_length,omitempty"` //【返回】大小
ResponseTime time.Time `gorm:"index;comment:【返回】时间" json:"response_time,omitempty"` //【返回】时间
SystemHostName string `gorm:"index;comment:【系统】主机名" json:"system_host_name,omitempty"` //【系统】主机名
SystemInsideIp string `gorm:"type:inet;default:0.0.0.0;comment:【系统】内网ip" json:"system_inside_ip,omitempty"` //【系统】内网ip
SystemOs string `gorm:"index;comment:【系统】系统类型" json:"system_os,omitempty"` //【系统】系统类型
SystemArch string `gorm:"index;comment:【系统】系统架构" json:"system_arch,omitempty"` //【系统】系统架构
GoVersion string `gorm:"comment:【程序】Go版本" json:"go_version,omitempty"` //【程序】Go版本
SdkVersion string `gorm:"comment:【程序】Sdk版本" json:"sdk_version,omitempty"` //【程序】Sdk版本
}

@ -4,25 +4,25 @@ import "time"
// 模型
type apiPostgresqlLogString struct {
LogId uint `gorm:"primaryKey;comment:【记录】编号" json:"log_id,omitempty"` //【记录】编号
TraceId string `gorm:"index;comment:【系统】跟踪编号" json:"trace_id,omitempty"` //【系统】跟踪编号
RequestTime time.Time `gorm:"index;comment:【请求】时间" json:"request_time,omitempty"` //【请求】时间
RequestUri string `gorm:"comment:【请求】链接" json:"request_uri,omitempty"` //【请求】链接
RequestUrl string `gorm:"comment:【请求】链接" json:"request_url,omitempty"` //【请求】链接
RequestApi string `gorm:"index;comment:【请求】接口" json:"request_api,omitempty"` //【请求】接口
RequestMethod string `gorm:"index;comment:【请求】方式" json:"request_method,omitempty"` //【请求】方式
RequestParams string `gorm:"comment:【请求】参数" json:"request_params,omitempty"` //【请求】参数
RequestHeader string `gorm:"comment:【请求】头部" json:"request_header,omitempty"` //【请求】头部
RequestIp string `gorm:"index;comment:【请求】请求Ip" json:"request_ip,omitempty"` //【请求】请求Ip
ResponseHeader string `gorm:"comment:【返回】头部" json:"response_header,omitempty"` //【返回】头部
ResponseStatusCode int `gorm:"index;comment:【返回】状态码" json:"response_status_code,omitempty"` //【返回】状态码
ResponseBody string `gorm:"comment:【返回】数据" json:"response_content,omitempty"` //【返回】数据
ResponseContentLength int64 `gorm:"comment:【返回】大小" json:"response_content_length,omitempty"` //【返回】大小
ResponseTime time.Time `gorm:"index;comment:【返回】时间" json:"response_time,omitempty"` //【返回】时间
SystemHostName string `gorm:"index;comment:【系统】主机名" json:"system_host_name,omitempty"` //【系统】主机名
SystemInsideIp string `gorm:"index;comment:【系统】内网ip" json:"system_inside_ip,omitempty"` //【系统】内网ip
SystemOs string `gorm:"index;comment:【系统】系统类型" json:"system_os,omitempty"` //【系统】系统类型
SystemArch string `gorm:"index;comment:【系统】系统架构" json:"system_arch,omitempty"` //【系统】系统架构
GoVersion string `gorm:"comment:【程序】Go版本" json:"go_version,omitempty"` //【程序】Go版本
SdkVersion string `gorm:"comment:【程序】Sdk版本" json:"sdk_version,omitempty"` //【程序】Sdk版本
LogId uint `gorm:"primaryKey;comment:【记录】编号" json:"log_id,omitempty"` //【记录】编号
TraceId string `gorm:"index;comment:【系统】跟踪编号" json:"trace_id,omitempty"` //【系统】跟踪编号
RequestTime time.Time `gorm:"index;comment:【请求】时间" json:"request_time,omitempty"` //【请求】时间
RequestUri string `gorm:"comment:【请求】链接" json:"request_uri,omitempty"` //【请求】链接
RequestUrl string `gorm:"comment:【请求】链接" json:"request_url,omitempty"` //【请求】链接
RequestApi string `gorm:"index;comment:【请求】接口" json:"request_api,omitempty"` //【请求】接口
RequestMethod string `gorm:"index;comment:【请求】方式" json:"request_method,omitempty"` //【请求】方式
RequestParams string `gorm:"comment:【请求】参数" json:"request_params,omitempty"` //【请求】参数
RequestHeader string `gorm:"comment:【请求】头部" json:"request_header,omitempty"` //【请求】头部
RequestIp string `gorm:"type:inet;default:0.0.0.0;index;comment:【请求】请求Ip" json:"request_ip,omitempty"` //【请求】请求Ip
ResponseHeader string `gorm:"comment:【返回】头部" json:"response_header,omitempty"` //【返回】头部
ResponseStatusCode int `gorm:"index;comment:【返回】状态码" json:"response_status_code,omitempty"` //【返回】状态码
ResponseBody string `gorm:"comment:【返回】数据" json:"response_content,omitempty"` //【返回】数据
ResponseContentLength int64 `gorm:"comment:【返回】大小" json:"response_content_length,omitempty"` //【返回】大小
ResponseTime time.Time `gorm:"index;comment:【返回】时间" json:"response_time,omitempty"` //【返回】时间
SystemHostName string `gorm:"index;comment:【系统】主机名" json:"system_host_name,omitempty"` //【系统】主机名
SystemInsideIp string `gorm:"type:inet;default:0.0.0.0;comment:【系统】内网ip" json:"system_inside_ip,omitempty"` //【系统】内网ip
SystemOs string `gorm:"index;comment:【系统】系统类型" json:"system_os,omitempty"` //【系统】系统类型
SystemArch string `gorm:"index;comment:【系统】系统架构" json:"system_arch,omitempty"` //【系统】系统架构
GoVersion string `gorm:"comment:【程序】Go版本" json:"go_version,omitempty"` //【程序】Go版本
SdkVersion string `gorm:"comment:【程序】Sdk版本" json:"sdk_version,omitempty"` //【程序】Sdk版本
}

@ -1,5 +1,5 @@
package golog
const (
Version = "1.0.82"
Version = "1.0.84"
)

30
vendor/go.dtapp.net/golog/gin.go generated vendored

@ -13,8 +13,6 @@ import (
"go.dtapp.net/gotrace_id"
"io/ioutil"
"net"
"os"
"runtime"
)
// GinClientFun *GinClient 驱动
@ -32,14 +30,16 @@ type GinClient struct {
logDebug bool // 日志开关
gormConfig struct {
tableName string // 表名
insideIp string // 内网ip
hostname string // 主机名
goVersion string // go版本
}
config struct {
os string // 系统类型
arch string // 系统架构
jsonStatus bool // json状态
systemHostName string // 主机名
systemInsideIp string // 内网ip
systemOs string // 系统类型
systemArch string // 系统架构
goVersion string // go版本
sdkVersion string // sdk版本
systemOutsideIp string // 外网ip
jsonStatus bool // json状态
}
}
@ -68,17 +68,12 @@ func NewGinClient(config *GinClientConfig) (*GinClient, error) {
c.config.jsonStatus = config.JsonStatus
c.config.os = runtime.GOOS
c.config.arch = runtime.GOARCH
gormClient, gormTableName := config.GormClientFun()
if gormClient == nil || gormClient.Db == nil {
return nil, errors.New("没有设置驱动")
return nil, gormClientFunNoConfig
}
hostname, _ := os.Hostname()
if gormClient != nil || gormClient.Db != nil {
c.gormClient = gormClient
@ -95,12 +90,11 @@ func NewGinClient(config *GinClientConfig) (*GinClient, error) {
return nil, errors.New("创建表失败:" + err.Error())
}
c.gormConfig.hostname = hostname
c.gormConfig.insideIp = goip.GetInsideIp(ctx)
c.gormConfig.goVersion = runtime.Version()
}
// 配置信息
c.setConfig(ctx)
return c, nil
}

@ -15,8 +15,6 @@ import (
"gorm.io/datatypes"
"io/ioutil"
"net"
"os"
"runtime"
"time"
)
@ -48,7 +46,7 @@ func NewGinGormClient(config *GinGormClientConfig) (*GinClient, error) {
client, tableName := config.GormClientFun()
if client == nil || client.Db == nil {
return nil, errors.New("没有设置驱动")
return nil, gormClientFunNoConfig
}
c.gormClient = client
@ -65,11 +63,8 @@ func NewGinGormClient(config *GinGormClientConfig) (*GinClient, error) {
return nil, errors.New("创建表失败:" + err.Error())
}
hostname, _ := os.Hostname()
c.gormConfig.hostname = hostname
c.gormConfig.insideIp = goip.GetInsideIp(ctx)
c.gormConfig.goVersion = runtime.Version()
// 配置信息
c.setConfig(ctx)
return c, nil
}
@ -93,14 +88,12 @@ func (c *GinClient) gormAutoMigrate() (err error) {
// gormRecord 记录日志
func (c *GinClient) gormRecord(data ginPostgresqlLogString) (err error) {
data.SystemHostName = c.gormConfig.hostname
data.SystemInsideIp = c.gormConfig.insideIp
data.GoVersion = c.gormConfig.goVersion
data.SdkVersion = Version
data.SystemOs = c.config.os
data.SystemArch = c.config.arch
data.SystemHostName = c.config.systemHostName
data.SystemInsideIp = c.config.systemInsideIp
data.GoVersion = c.config.goVersion
data.SdkVersion = c.config.sdkVersion
data.SystemOs = c.config.systemOs
data.SystemArch = c.config.systemArch
if c.config.jsonStatus {
err = c.gormClient.Db.Table(c.gormConfig.tableName).Create(&ginPostgresqlLogJson{

@ -7,36 +7,36 @@ import (
// 模型
type ginPostgresqlLogJson struct {
LogId uint `gorm:"primaryKey;comment:【记录】编号" json:"log_id,omitempty"` //【记录】编号
TraceId string `gorm:"index;comment:【系统】跟踪编号" json:"trace_id,omitempty"` //【系统】跟踪编号
RequestTime time.Time `gorm:"index;comment:【请求】时间" json:"request_time,omitempty"` //【请求】时间
RequestUri string `gorm:"comment:【请求】请求链接 域名+路径+参数" json:"request_uri,omitempty"` //【请求】请求链接 域名+路径+参数
RequestUrl string `gorm:"comment:【请求】请求链接 域名+路径" json:"request_url,omitempty"` //【请求】请求链接 域名+路径
RequestApi string `gorm:"index;comment:【请求】请求接口 路径" json:"request_api,omitempty"` //【请求】请求接口 路径
RequestMethod string `gorm:"index;comment:【请求】请求方式" json:"request_method,omitempty"` //【请求】请求方式
RequestProto string `gorm:"comment:【请求】请求协议" json:"request_proto,omitempty"` //【请求】请求协议
RequestUa string `gorm:"comment:【请求】请求UA" json:"request_ua,omitempty"` //【请求】请求UA
RequestReferer string `gorm:"comment:【请求】请求referer" json:"request_referer,omitempty"` //【请求】请求referer
RequestBody datatypes.JSON `gorm:"type:jsonb;comment:【请求】请求主体" json:"request_body,omitempty"` //【请求】请求主体
RequestUrlQuery datatypes.JSON `gorm:"type:jsonb;comment:【请求】请求URL参数" json:"request_url_query,omitempty"` //【请求】请求URL参数
RequestIp string `gorm:"index;comment:【请求】请求客户端Ip" json:"request_ip,omitempty"` //【请求】请求客户端Ip
RequestIpCountry string `gorm:"index;comment:【请求】请求客户端城市" json:"request_ip_country,omitempty"` //【请求】请求客户端城市
RequestIpProvince string `gorm:"index;comment:【请求】请求客户端省份" json:"request_ip_province,omitempty"` //【请求】请求客户端省份
RequestIpCity string `gorm:"index;comment:【请求】请求客户端城市" json:"request_ip_city,omitempty"` //【请求】请求客户端城市
RequestIpIsp string `gorm:"index;comment:【请求】请求客户端运营商" json:"request_ip_isp,omitempty"` //【请求】请求客户端运营商
RequestIpLongitude float64 `gorm:"index;comment:【请求】请求客户端经度" json:"request_ip_longitude,omitempty"` //【请求】请求客户端经度
RequestIpLatitude float64 `gorm:"index;comment:【请求】请求客户端纬度" json:"request_ip_latitude,omitempty"` //【请求】请求客户端纬度
LogId uint `gorm:"primaryKey;comment:【记录】编号" json:"log_id,omitempty"` //【记录】编号
TraceId string `gorm:"index;comment:【系统】跟踪编号" json:"trace_id,omitempty"` //【系统】跟踪编号
RequestTime time.Time `gorm:"index;comment:【请求】时间" json:"request_time,omitempty"` //【请求】时间
RequestUri string `gorm:"comment:【请求】请求链接 域名+路径+参数" json:"request_uri,omitempty"` //【请求】请求链接 域名+路径+参数
RequestUrl string `gorm:"comment:【请求】请求链接 域名+路径" json:"request_url,omitempty"` //【请求】请求链接 域名+路径
RequestApi string `gorm:"index;comment:【请求】请求接口 路径" json:"request_api,omitempty"` //【请求】请求接口 路径
RequestMethod string `gorm:"index;comment:【请求】请求方式" json:"request_method,omitempty"` //【请求】请求方式
RequestProto string `gorm:"comment:【请求】请求协议" json:"request_proto,omitempty"` //【请求】请求协议
RequestUa string `gorm:"comment:【请求】请求UA" json:"request_ua,omitempty"` //【请求】请求UA
RequestReferer string `gorm:"comment:【请求】请求referer" json:"request_referer,omitempty"` //【请求】请求referer
RequestBody datatypes.JSON `gorm:"type:jsonb;comment:【请求】请求主体" json:"request_body,omitempty"` //【请求】请求主体
RequestUrlQuery datatypes.JSON `gorm:"type:jsonb;comment:【请求】请求URL参数" json:"request_url_query,omitempty"` //【请求】请求URL参数
RequestIp string `gorm:"type:inet;default:0.0.0.0;index;comment:【请求】请求客户端Ip" json:"request_ip,omitempty"` //【请求】请求客户端Ip
RequestIpCountry string `gorm:"index;comment:【请求】请求客户端城市" json:"request_ip_country,omitempty"` //【请求】请求客户端城市
RequestIpProvince string `gorm:"index;comment:【请求】请求客户端省份" json:"request_ip_province,omitempty"` //【请求】请求客户端省份
RequestIpCity string `gorm:"index;comment:【请求】请求客户端城市" json:"request_ip_city,omitempty"` //【请求】请求客户端城市
RequestIpIsp string `gorm:"index;comment:【请求】请求客户端运营商" json:"request_ip_isp,omitempty"` //【请求】请求客户端运营商
RequestIpLongitude float64 `gorm:"index;comment:【请求】请求客户端经度" json:"request_ip_longitude,omitempty"` //【请求】请求客户端经度
RequestIpLatitude float64 `gorm:"index;comment:【请求】请求客户端纬度" json:"request_ip_latitude,omitempty"` //【请求】请求客户端纬度
//RequestIpLocation `gorm:"index;comment:【请求】请求客户端位置" json:"request_ip_location,omitempty"` //【请求】请求客户端位置
RequestHeader datatypes.JSON `gorm:"type:jsonb;comment:【请求】请求头" json:"request_header,omitempty"` //【请求】请求头
ResponseTime time.Time `gorm:"index;comment:【返回】时间" json:"response_time,omitempty"` //【返回】时间
ResponseCode int `gorm:"index;comment:【返回】状态码" json:"response_code,omitempty"` //【返回】状态码
ResponseMsg string `gorm:"comment:【返回】描述" json:"response_msg,omitempty"` //【返回】描述
ResponseData datatypes.JSON `gorm:"type:jsonb;comment:【返回】数据" json:"response_data,omitempty"` //【返回】数据
CostTime int64 `gorm:"comment:【系统】花费时间" json:"cost_time,omitempty"` //【系统】花费时间
SystemHostName string `gorm:"index;comment:【系统】主机名" json:"system_host_name,omitempty"` //【系统】主机名
SystemInsideIp string `gorm:"index;comment:【系统】内网ip" json:"system_inside_ip,omitempty"` //【系统】内网ip
SystemOs string `gorm:"index;comment:【系统】系统类型" json:"system_os,omitempty"` //【系统】系统类型
SystemArch string `gorm:"index;comment:【系统】系统架构" json:"system_arch,omitempty"` //【系统】系统架构
GoVersion string `gorm:"comment:【程序】Go版本" json:"go_version,omitempty"` //【程序】Go版本
SdkVersion string `gorm:"comment:【程序】Sdk版本" json:"sdk_version,omitempty"` //【程序】Sdk版本
RequestHeader datatypes.JSON `gorm:"type:jsonb;comment:【请求】请求头" json:"request_header,omitempty"` //【请求】请求头
ResponseTime time.Time `gorm:"index;comment:【返回】时间" json:"response_time,omitempty"` //【返回】时间
ResponseCode int `gorm:"index;comment:【返回】状态码" json:"response_code,omitempty"` //【返回】状态码
ResponseMsg string `gorm:"comment:【返回】描述" json:"response_msg,omitempty"` //【返回】描述
ResponseData datatypes.JSON `gorm:"type:jsonb;comment:【返回】数据" json:"response_data,omitempty"` //【返回】数据
CostTime int64 `gorm:"comment:【系统】花费时间" json:"cost_time,omitempty"` //【系统】花费时间
SystemHostName string `gorm:"index;comment:【系统】主机名" json:"system_host_name,omitempty"` //【系统】主机名
SystemInsideIp string `gorm:"type:inet;default:0.0.0.0;comment:【系统】内网ip" json:"system_inside_ip,omitempty"` //【系统】内网ip
SystemOs string `gorm:"index;comment:【系统】系统类型" json:"system_os,omitempty"` //【系统】系统类型
SystemArch string `gorm:"index;comment:【系统】系统架构" json:"system_arch,omitempty"` //【系统】系统架构
GoVersion string `gorm:"comment:【程序】Go版本" json:"go_version,omitempty"` //【程序】Go版本
SdkVersion string `gorm:"comment:【程序】Sdk版本" json:"sdk_version,omitempty"` //【程序】Sdk版本
}

@ -4,36 +4,36 @@ import "time"
// 模型
type ginPostgresqlLogString struct {
LogId uint `gorm:"primaryKey;comment:【记录】编号" json:"log_id,omitempty"` //【记录】编号
TraceId string `gorm:"index;comment:【系统】跟踪编号" json:"trace_id,omitempty"` //【系统】跟踪编号
RequestTime time.Time `gorm:"index;comment:【请求】时间" json:"request_time,omitempty"` //【请求】时间
RequestUri string `gorm:"comment:【请求】请求链接 域名+路径+参数" json:"request_uri,omitempty"` //【请求】请求链接 域名+路径+参数
RequestUrl string `gorm:"comment:【请求】请求链接 域名+路径" json:"request_url,omitempty"` //【请求】请求链接 域名+路径
RequestApi string `gorm:"index;comment:【请求】请求接口 路径" json:"request_api,omitempty"` //【请求】请求接口 路径
RequestMethod string `gorm:"index;comment:【请求】请求方式" json:"request_method,omitempty"` //【请求】请求方式
RequestProto string `gorm:"comment:【请求】请求协议" json:"request_proto,omitempty"` //【请求】请求协议
RequestUa string `gorm:"comment:【请求】请求UA" json:"request_ua,omitempty"` //【请求】请求UA
RequestReferer string `gorm:"comment:【请求】请求referer" json:"request_referer,omitempty"` //【请求】请求referer
RequestBody string `gorm:"comment:【请求】请求主体" json:"request_body,omitempty"` //【请求】请求主体
RequestUrlQuery string `gorm:"comment:【请求】请求URL参数" json:"request_url_query,omitempty"` //【请求】请求URL参数
RequestIp string `gorm:"index;comment:【请求】请求客户端Ip" json:"request_ip,omitempty"` //【请求】请求客户端Ip
RequestIpCountry string `gorm:"index;comment:【请求】请求客户端城市" json:"request_ip_country,omitempty"` //【请求】请求客户端城市
RequestIpProvince string `gorm:"index;comment:【请求】请求客户端省份" json:"request_ip_province,omitempty"` //【请求】请求客户端省份
RequestIpCity string `gorm:"index;comment:【请求】请求客户端城市" json:"request_ip_city,omitempty"` //【请求】请求客户端城市
RequestIpIsp string `gorm:"index;comment:【请求】请求客户端运营商" json:"request_ip_isp,omitempty"` //【请求】请求客户端运营商
RequestIpLongitude float64 `gorm:"index;comment:【请求】请求客户端经度" json:"request_ip_longitude,omitempty"` //【请求】请求客户端经度
RequestIpLatitude float64 `gorm:"index;comment:【请求】请求客户端纬度" json:"request_ip_latitude,omitempty"` //【请求】请求客户端纬度
LogId uint `gorm:"primaryKey;comment:【记录】编号" json:"log_id,omitempty"` //【记录】编号
TraceId string `gorm:"index;comment:【系统】跟踪编号" json:"trace_id,omitempty"` //【系统】跟踪编号
RequestTime time.Time `gorm:"index;comment:【请求】时间" json:"request_time,omitempty"` //【请求】时间
RequestUri string `gorm:"comment:【请求】请求链接 域名+路径+参数" json:"request_uri,omitempty"` //【请求】请求链接 域名+路径+参数
RequestUrl string `gorm:"comment:【请求】请求链接 域名+路径" json:"request_url,omitempty"` //【请求】请求链接 域名+路径
RequestApi string `gorm:"index;comment:【请求】请求接口 路径" json:"request_api,omitempty"` //【请求】请求接口 路径
RequestMethod string `gorm:"index;comment:【请求】请求方式" json:"request_method,omitempty"` //【请求】请求方式
RequestProto string `gorm:"comment:【请求】请求协议" json:"request_proto,omitempty"` //【请求】请求协议
RequestUa string `gorm:"comment:【请求】请求UA" json:"request_ua,omitempty"` //【请求】请求UA
RequestReferer string `gorm:"comment:【请求】请求referer" json:"request_referer,omitempty"` //【请求】请求referer
RequestBody string `gorm:"comment:【请求】请求主体" json:"request_body,omitempty"` //【请求】请求主体
RequestUrlQuery string `gorm:"comment:【请求】请求URL参数" json:"request_url_query,omitempty"` //【请求】请求URL参数
RequestIp string `gorm:"type:inet;default:0.0.0.0;index;comment:【请求】请求客户端Ip" json:"request_ip,omitempty"` //【请求】请求客户端Ip
RequestIpCountry string `gorm:"index;comment:【请求】请求客户端城市" json:"request_ip_country,omitempty"` //【请求】请求客户端城市
RequestIpProvince string `gorm:"index;comment:【请求】请求客户端省份" json:"request_ip_province,omitempty"` //【请求】请求客户端省份
RequestIpCity string `gorm:"index;comment:【请求】请求客户端城市" json:"request_ip_city,omitempty"` //【请求】请求客户端城市
RequestIpIsp string `gorm:"index;comment:【请求】请求客户端运营商" json:"request_ip_isp,omitempty"` //【请求】请求客户端运营商
RequestIpLongitude float64 `gorm:"index;comment:【请求】请求客户端经度" json:"request_ip_longitude,omitempty"` //【请求】请求客户端经度
RequestIpLatitude float64 `gorm:"index;comment:【请求】请求客户端纬度" json:"request_ip_latitude,omitempty"` //【请求】请求客户端纬度
//RequestIpLocation `gorm:"index;comment:【请求】请求客户端位置" json:"request_ip_location,omitempty"` //【请求】请求客户端位置
RequestHeader string `gorm:"comment:【请求】请求头" json:"request_header,omitempty"` //【请求】请求头
ResponseTime time.Time `gorm:"index;comment:【返回】时间" json:"response_time,omitempty"` //【返回】时间
ResponseCode int `gorm:"index;comment:【返回】状态码" json:"response_code,omitempty"` //【返回】状态码
ResponseMsg string `gorm:"comment:【返回】描述" json:"response_msg,omitempty"` //【返回】描述
ResponseData string `gorm:"comment:【返回】数据" json:"response_data,omitempty"` //【返回】数据
CostTime int64 `gorm:"comment:【系统】花费时间" json:"cost_time,omitempty"` //【系统】花费时间
SystemHostName string `gorm:"index;comment:【系统】主机名" json:"system_host_name,omitempty"` //【系统】主机名
SystemInsideIp string `gorm:"index;comment:【系统】内网ip" json:"system_inside_ip,omitempty"` //【系统】内网ip
SystemOs string `gorm:"index;comment:【系统】系统类型" json:"system_os,omitempty"` //【系统】系统类型
SystemArch string `gorm:"index;comment:【系统】系统架构" json:"system_arch,omitempty"` //【系统】系统架构
GoVersion string `gorm:"comment:【程序】Go版本" json:"go_version,omitempty"` //【程序】Go版本
SdkVersion string `gorm:"comment:【程序】Sdk版本" json:"sdk_version,omitempty"` //【程序】Sdk版本
RequestHeader string `gorm:"comment:【请求】请求头" json:"request_header,omitempty"` //【请求】请求头
ResponseTime time.Time `gorm:"index;comment:【返回】时间" json:"response_time,omitempty"` //【返回】时间
ResponseCode int `gorm:"index;comment:【返回】状态码" json:"response_code,omitempty"` //【返回】状态码
ResponseMsg string `gorm:"comment:【返回】描述" json:"response_msg,omitempty"` //【返回】描述
ResponseData string `gorm:"comment:【返回】数据" json:"response_data,omitempty"` //【返回】数据
CostTime int64 `gorm:"comment:【系统】花费时间" json:"cost_time,omitempty"` //【系统】花费时间
SystemHostName string `gorm:"index;comment:【系统】主机名" json:"system_host_name,omitempty"` //【系统】主机名
SystemInsideIp string `gorm:"type:inet;default:0.0.0.0;comment:【系统】内网ip" json:"system_inside_ip,omitempty"` //【系统】内网ip
SystemOs string `gorm:"index;comment:【系统】系统类型" json:"system_os,omitempty"` //【系统】系统类型
SystemArch string `gorm:"index;comment:【系统】系统架构" json:"system_arch,omitempty"` //【系统】系统架构
GoVersion string `gorm:"comment:【程序】Go版本" json:"go_version,omitempty"` //【程序】Go版本
SdkVersion string `gorm:"comment:【程序】Sdk版本" json:"sdk_version,omitempty"` //【程序】Sdk版本
}

@ -265,7 +265,7 @@ go.dtapp.net/goip/ip2region
go.dtapp.net/goip/ip2region_v2
go.dtapp.net/goip/ipv6wry
go.dtapp.net/goip/qqwry
# go.dtapp.net/golog v1.0.82
# go.dtapp.net/golog v1.0.84
## explicit; go 1.19
go.dtapp.net/golog
# go.dtapp.net/gorandom v1.0.1

Loading…
Cancel
Save