package userrpc
|
|
|
|
import (
|
|
"encoding/json"
|
|
)
|
|
|
|
/**
|
|
* 查找第三方平台openid V2版
|
|
* 2021/09/07
|
|
* gz
|
|
*/
|
|
func GetUserThird(site_id, dbname, platform, user_id, field string, url ...string) (map[string]string, error) {
|
|
|
|
conn, err := rpc_server_conn(url...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer conn.Close()
|
|
|
|
data := map[string]string{
|
|
"site_id": site_id,
|
|
"dbname": dbname,
|
|
"user_id": user_id,
|
|
"platform": platform,
|
|
"field": field,
|
|
}
|
|
|
|
req, err := SetReqData(data)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
res := &Response{}
|
|
|
|
err = conn.GetUserThird(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
|
|
|
|
}
|