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/wikeyun/app.go

28 lines
713 B

package wikeyun
import (
"fmt"
"go.dtapp.net/library/utils/gohttp"
"go.dtapp.net/library/utils/gomongo"
"net/http"
)
type App struct {
StoreID int
AppKey int
AppSecret string
ClientIP string
Mongo gomongo.App // 日志数据库
}
func (app *App) request(url string, params map[string]interface{}) (resp []byte, err error) {
// 签名
sign := app.sign(params)
// 请求
requestUrl := fmt.Sprintf("%s?app_key=%d&timestamp=%s&client=%s&format=%s&v=%s&sign=%s", url, app.AppKey, sign.Timestamp, sign.Client, sign.Format, sign.V, sign.Sign)
postForm, err := gohttp.PostForm(requestUrl, params)
// 日志
go app.mongoLog(url, params, http.MethodPost, postForm)
return postForm.Body, err
}