...
|
...
|
@@ -4,6 +4,7 @@ import ( |
|
|
"crypto/sha1"
|
|
|
"encoding/hex"
|
|
|
"encoding/json"
|
|
|
"fmt"
|
|
|
"io/ioutil"
|
|
|
"math/rand"
|
|
|
"net/http"
|
...
|
...
|
@@ -13,6 +14,19 @@ import ( |
|
|
"time"
|
|
|
)
|
|
|
|
|
|
|
|
|
var DefaultImClient ImClient
|
|
|
|
|
|
var ErrorFailCall = fmt.Errorf(" imclient call failed")
|
|
|
|
|
|
func InitImClient(baseUrl ,appKey,appSecret string){
|
|
|
DefaultImClient = ImClient{
|
|
|
baseUrl:baseUrl,
|
|
|
appKey:appKey,
|
|
|
appSecret:appSecret,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func buildCheckSum(appSecret string, nonce string, curTime string) string {
|
|
|
str := []byte(appSecret + nonce + curTime)
|
|
|
sh := sha1.New()
|
...
|
...
|
|