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.
dingtalk/request.go

41 lines
740 B

2 years ago
package dingtalk
2 years ago
import (
"context"
"go.dtapp.net/gorequest"
)
2 years ago
2 years ago
func (c *Client) request(ctx context.Context, url string, params map[string]interface{}, method string) (gorequest.Response, error) {
2 years ago
// 创建请求
2 years ago
client := c.requestClient
2 years ago
// 设置请求地址
client.SetUri(url)
// 设置方式
client.SetMethod(method)
// 设置格式
client.SetContentTypeJson()
// 设置参数
client.SetParams(params)
// 发起请求
2 years ago
request, err := client.Request(ctx)
2 years ago
if err != nil {
return gorequest.Response{}, err
}
// 日志
2 years ago
if c.log.gorm {
go c.log.logGormClient.GormMiddleware(ctx, request, Version)
}
if c.log.mongo {
go c.log.logMongoClient.MongoMiddleware(ctx, request, Version)
2 years ago
}
return request, err
}