37 lines
742 B
Go
37 lines
742 B
Go
|
|
package tong_cheng
|
||
|
|
|
||
|
|
import (
|
||
|
|
"github.com/zeromicro/go-zero/core/logx"
|
||
|
|
|
||
|
|
"gitee.com/chengdu-lenntc/third-platform-sdk/client"
|
||
|
|
)
|
||
|
|
|
||
|
|
// AuthConfig api鉴权参数
|
||
|
|
type AuthConfig struct {
|
||
|
|
Token string // 分配的token
|
||
|
|
}
|
||
|
|
|
||
|
|
// 连接第三方平台的client
|
||
|
|
type Client struct {
|
||
|
|
log logx.Logger
|
||
|
|
authConfig AuthConfig
|
||
|
|
client.HttpClient
|
||
|
|
headers map[string]string
|
||
|
|
}
|
||
|
|
|
||
|
|
func NewApiClient(log logx.Logger, conf AuthConfig) TongChengApi {
|
||
|
|
clt := newClient(log, conf)
|
||
|
|
return newTongChengApiImpl(log, clt)
|
||
|
|
}
|
||
|
|
|
||
|
|
func newClient(log logx.Logger, conf AuthConfig) *Client {
|
||
|
|
return &Client{
|
||
|
|
log: log,
|
||
|
|
authConfig: conf,
|
||
|
|
HttpClient: client.NewHttpClient(log),
|
||
|
|
headers: map[string]string{
|
||
|
|
"Content-Type": "application/json",
|
||
|
|
},
|
||
|
|
}
|
||
|
|
}
|