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.
39 lines
756 B
39 lines
756 B
package wikeyun
|
|
|
|
import (
|
|
"fmt"
|
|
"go.dtapp.net/library/utils/gorequest"
|
|
)
|
|
|
|
// 请求接口
|
|
func (c *Client) request(url string, params map[string]interface{}) (gorequest.Response, error) {
|
|
|
|
// 签名
|
|
sign := c.sign(params)
|
|
|
|
// 创建请求
|
|
client := c.client
|
|
|
|
// 设置请求地址
|
|
client.SetUri(fmt.Sprintf("%s?app_key=%d×tamp=%s&client=%s&format=%s&v=%s&sign=%s", url, c.config.AppKey, sign.Timestamp, sign.Client, sign.Format, sign.V, sign.Sign))
|
|
|
|
// 设置FORM格式
|
|
client.SetContentTypeForm()
|
|
|
|
// 设置参数
|
|
client.SetParams(params)
|
|
|
|
// 发起请求
|
|
request, err := client.Post()
|
|
if err != nil {
|
|
return gorequest.Response{}, err
|
|
}
|
|
|
|
// 日志
|
|
if c.logStatus == true {
|
|
go c.postgresqlLog(request)
|
|
}
|
|
|
|
return request, err
|
|
}
|