用户接口远程调用
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.

54 lines
965 B

  1. package userrpc
  2. /**
  3. * 绑定第三方平台openid
  4. * 2021/04/05
  5. * gz
  6. */
  7. func BindThird(site_id, dbname, platform, user_id, openid, openname, unionid, avatar string, url ...string) (*Res, error) {
  8. conn, err := rpc_server_conn(url...)
  9. if err != nil {
  10. return nil, err
  11. }
  12. defer conn.Close()
  13. data := BindThirdReq{}
  14. data.SiteId = site_id
  15. data.Dbname = dbname
  16. data.Openid = openid
  17. data.Openname = openname
  18. data.Platform = platform
  19. data.Unionid = unionid
  20. data.Avatar = avatar
  21. data.Userid = user_id
  22. data_json, err := json.Marshal(data)
  23. if err != nil {
  24. return nil, err
  25. }
  26. encryData := crypter.DesEn(string(data_json), DES_KEY)
  27. now_int64 := time.Now().Unix()
  28. now := strconv.FormatInt(now_int64, 10)
  29. sign := Sign(encryData, now)
  30. req := &Request{
  31. proto.String(encryData),
  32. proto.String(now),
  33. proto.String(sign),
  34. nil}
  35. res := &Response{}
  36. err = conn.BindThird(req, res)
  37. if err != nil {
  38. return nil, err
  39. }
  40. return HandleRes(res)
  41. }