|
|
@ -0,0 +1,54 @@ |
|
|
|
package userrpc |
|
|
|
|
|
|
|
import ( |
|
|
|
"encoding/json" |
|
|
|
"errors" |
|
|
|
) |
|
|
|
|
|
|
|
func GetAddressInfo(site_id, dbname, address_id string, url ...string) (map[string]string, error) { |
|
|
|
|
|
|
|
if dbname == "" || address_id == "" { |
|
|
|
return nil, errors.New("参数错误") |
|
|
|
} |
|
|
|
|
|
|
|
conn, err := rpc_server_conn(url...) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
defer conn.Close() |
|
|
|
|
|
|
|
data := GetAddressReq{} |
|
|
|
data.SiteId = site_id |
|
|
|
data.Dbname = dbname |
|
|
|
data.AddressId = address_id |
|
|
|
|
|
|
|
req, err := SetReqData(data) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
|
|
|
|
res := &Response{} |
|
|
|
|
|
|
|
err = conn.GetAddressInfo(req, res) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
|
|
|
|
res_data_de, err := GetResData(res) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
if res_data_de == "" { |
|
|
|
return nil, nil |
|
|
|
} |
|
|
|
var res_arr map[string]string |
|
|
|
|
|
|
|
err = json.Unmarshal([]byte(res_data_de), &res_arr) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
return res_arr, nil |
|
|
|
|
|
|
|
} |