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.
go-library/service/jd/request.go

41 lines
862 B

package jd
import (
2 years ago
"context"
"github.com/dtapps/go-library"
2 years ago
"github.com/dtapps/go-library/utils/gorequest"
"github.com/dtapps/go-library/utils/gostring"
)
// 请求接口
2 years ago
func (c *Client) request(ctx context.Context, params map[string]interface{}) (gorequest.Response, error) {
// 签名
c.Sign(params)
// 创建请求
client := c.client
// 设置格式
client.SetContentTypeForm()
// 设置参数
client.SetParams(params)
// 发起请求
2 years ago
request, err := client.Post(ctx)
if err != nil {
return gorequest.Response{}, err
}
// 日志
2 years ago
if c.config.PgsqlDb != nil {
2 years ago
go c.log.GormMiddlewareCustom(ctx, gostring.ToString(params["method"]), request, go_library.Version())
}
2 years ago
if c.config.MongoDb != nil {
2 years ago
go c.log.MongoMiddlewareCustom(ctx, gostring.ToString(params["method"]), request, go_library.Version())
2 years ago
}
return request, err
}