package siterpc import ( "encoding/json" "strconv" "time" "git.tetele.net/tgo/crypter" "github.com/golang/protobuf/proto" ) /** * 由配置key取对应value * 请求及回均加密验签 * 2021/01/20 * GZ */ func GetAllSite(url ...string) ([]map[string]string, error) { conn, err := rpc_server_conn(url...) if err != nil { return nil, err } defer conn.Close() now_int64 := time.Now().Unix() encryData := crypter.DesEn("get_from_cache", DES_KEY) now := strconv.FormatInt(now_int64, 10) sign := Sign(encryData, now) req := &Request{proto.String(encryData), proto.String(now), proto.String(sign), nil} res := &Response{} err = conn.GetAllSite(req, res) if err != nil { return nil, err } res_data, err := GetOrgData(res) if err != nil { return []map[string]string{}, err } var res_arr []map[string]string err = json.Unmarshal([]byte(res_data), &res_arr) if err != nil { return []map[string]string{}, err } return res_arr, nil }