|
123456789101112131415161718192021222324252627 |
- package express
-
- import (
- zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils"
- "github.com/syyongx/php2go"
- "strings"
- "time"
- )
-
- func Send(mustParam map[string]string, apiCode string, data map[string]interface{}) (string, error) {
- url := mustParam["express_url"]
- key := mustParam["express_key"]
- clientId := mustParam["express_client_id"]
- timestamp := zhios_third_party_utils.Int64ToStr(time.Now().UnixNano() / 1e6)
- param := map[string]interface{}{
- "clientId": clientId,
- "timestamp": timestamp,
- "sign": getSign(key, clientId, timestamp),
- "apiCode": apiCode,
- "dataParams": data,
- }
- post, err := zhios_third_party_utils.CurlPost(url, zhios_third_party_utils.SerializeStr(param), nil)
- return string(post), err
- }
- func getSign(key, clientId, timestamp string) string {
- return strings.ToUpper(php2go.Md5("{\"clientId\":\"" + clientId + "\",\"privateKey\":\"" + key + "\",\"timestamp\":\"" + timestamp + "\"}"))
- }
|