|
1234567891011121314151617181920212223242526272829303132333435363738394041 |
- package dataoke
-
- import (
- zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils"
- "net/url"
- "sort"
- "strings"
- )
-
- var (
- Appkey = "5ce66ae30ff54"
- Appsecret = "07350d1665e55e1950a26ebb3dde23ed"
- )
-
- // url 地址 params 参数
- func SendReq(urls string, params map[string]string) ([]byte, error) {
- params["appKey"] = Appkey
- params["sign"] = Sign(params, Appsecret)
- var s url.URL
- q := s.Query()
- for k, v := range params {
- q.Add(k, v)
- }
- urls += "?" + q.Encode()
- return zhios_third_party_utils.CurlGet(urls, nil)
- }
- func Sign(args map[string]string, secret string) string {
- var keys []string
- for k := range args {
- keys = append(keys, k)
- }
- sort.Strings(keys)
- var str = ""
- for _, k := range keys {
- //拼接字符串
- str += k + "=" + args[k] + "&"
- }
-
- str += "key=" + secret
- return strings.ToUpper(zhios_third_party_utils.Md5(str))
- }
|