用户接口远程调用
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
898 B

  1. package userrpc
  2. import (
  3. "encoding/json"
  4. )
  5. /**
  6. * 查找第三方平台openid V2版
  7. * 2021/09/07
  8. * gz
  9. */
  10. func GetUserThird(site_id, dbname, platform, user_id, field string, url ...string) (map[string]string, error) {
  11. conn, err := rpc_server_conn(url...)
  12. if err != nil {
  13. return nil, err
  14. }
  15. defer conn.Close()
  16. data := map[string]string{
  17. "site_id": site_id,
  18. "dbname": dbname,
  19. "user_id": user_id,
  20. "platform": platform,
  21. "field": field,
  22. }
  23. req, err := SetReqData(data)
  24. if err != nil {
  25. return nil, err
  26. }
  27. res := &Response{}
  28. err = conn.GetUserThird(req, res)
  29. if err != nil {
  30. return nil, err
  31. }
  32. res_data_de, err := GetResData(res)
  33. if err != nil {
  34. return nil, err
  35. }
  36. if res_data_de == "" {
  37. return nil, nil
  38. }
  39. var res_arr map[string]string
  40. err = json.Unmarshal([]byte(res_data_de), &res_arr)
  41. if err != nil {
  42. return nil, err
  43. }
  44. return res_arr, nil
  45. }