third-platform-sdk/platform/meituan-csr/client.go

37 lines
759 B
Go
Raw Normal View History

2024-04-30 17:57:27 +08:00
package meituan_csr
2024-04-30 18:30:05 +08:00
import (
"github.com/zeromicro/go-zero/core/logx"
2024-05-01 14:05:18 +08:00
"gitee.com/chengdu-lenntc/third-platform-sdk/client"
2024-04-30 18:30:05 +08:00
)
// AuthConfig api鉴权参数
type AuthConfig struct {
2024-05-04 16:57:40 +08:00
AppKey string // 应用key
UtmSource string // 渠道来源
2024-04-30 18:30:05 +08:00
}
// 连接第三方平台的client
type Client struct {
2024-05-04 16:57:40 +08:00
client.HttpClient
2024-04-30 18:30:05 +08:00
log logx.Logger
authConfig AuthConfig
2024-05-01 17:14:00 +08:00
aes *AES
2024-04-30 18:30:05 +08:00
Headers map[string]string
}
func NewApiClient(log logx.Logger, conf AuthConfig) MeituanCsrApi {
clt := newClient(log, conf)
return newMeituanCsrApiImpl(log, clt)
}
2024-05-04 16:57:40 +08:00
func newClient(log logx.Logger, conf AuthConfig) *Client {
return &Client{
HttpClient: client.NewHttpClient(log),
log: log,
authConfig: conf,
aes: NewAes(conf.AppKey),
}
}