diff --git a/client.go b/client.go index e0e61f0..4337b69 100644 --- a/client.go +++ b/client.go @@ -17,10 +17,10 @@ type ConfigClient struct { LogDebug bool // 日志开关 } type Client struct { - client *gorequest.App // 请求客户端 - clientIp string // Ip - log *golog.ApiClient // 日志服务 - config *ConfigClient + requestClient *gorequest.App // 请求服务 + logClient *golog.ApiClient // 日志服务 + clientIp string // 当前Ip + config *ConfigClient // 配置 } func NewClient(config *ConfigClient) (*Client, error) { @@ -28,10 +28,10 @@ func NewClient(config *ConfigClient) (*Client, error) { var err error c := &Client{config: config} - c.client = gorequest.NewHttp() + c.requestClient = gorequest.NewHttp() if c.config.GormClient.Db != nil { - c.log, err = golog.NewApiClient(&golog.ApiClientConfig{ + c.logClient, err = golog.NewApiClient(&golog.ApiClientConfig{ GormClient: c.config.GormClient, TableName: logTable, LogClient: c.config.LogClient, diff --git a/const.go b/const.go index 030fdd7..e861bbe 100644 --- a/const.go +++ b/const.go @@ -12,4 +12,4 @@ const ( logTable = "wikeyun" ) -const Version = "1.0.11" +const Version = "1.0.12" diff --git a/request.go b/request.go index 06fe0af..aaec092 100644 --- a/request.go +++ b/request.go @@ -13,7 +13,7 @@ func (c *Client) request(ctx context.Context, url string, params map[string]inte sign := c.sign(params) // 创建请求 - client := c.client + client := c.requestClient // 设置请求地址 client.SetUri(fmt.Sprintf("%s?app_key=%d×tamp=%s&client=%s&format=%s&v=%s&sign=%s", url, c.config.AppKey, sign.Timestamp, sign.Client, sign.Format, sign.V, sign.Sign)) @@ -32,7 +32,7 @@ func (c *Client) request(ctx context.Context, url string, params map[string]inte // 日志 if c.config.GormClient.Db != nil { - go c.log.GormMiddleware(ctx, request, Version) + go c.logClient.GormMiddleware(ctx, request, Version) } return request, err