You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
taobao/client.go

53 lines
1.1 KiB

package taobao
import (
"go.dtapp.net/golog"
"go.dtapp.net/gorequest"
)
// ClientConfig 实例配置
type ClientConfig struct {
AppKey string // 应用Key
AppSecret string // 密钥
AdzoneId int64 // mm_xxx_xxx_xxx的第三位
}
// Client 实例
type Client struct {
requestClient *gorequest.App // 请求服务
config struct {
appKey string // 应用Key
appSecret string // 密钥
adzoneId int64 // mm_xxx_xxx_xxx的第三位
}
log struct {
status bool // 状态
client *golog.ApiClient // 日志服务
}
}
// NewClient 创建实例化
func NewClient(config *ClientConfig) (*Client, error) {
c := &Client{}
c.config.appKey = config.AppKey
c.config.appSecret = config.AppSecret
c.config.adzoneId = config.AdzoneId
c.requestClient = gorequest.NewHttp()
c.requestClient.Uri = apiUrl
return c, nil
}
type ErrResp struct {
ErrorResponse struct {
Code int `json:"code"`
Msg string `json:"msg"`
SubCode string `json:"sub_code"`
SubMsg string `json:"sub_msg"`
RequestId string `json:"request_id"`
} `json:"error_response"`
}