|
|
- package userrpc
-
- /**
- * 绑定第三方平台openid
- * 2021/04/05
- * gz
- */
- func BindThird(site_id, dbname, platform, user_id, openid, openname, unionid, avatar string, url ...string) (*Res, error) {
-
- conn, err := rpc_server_conn(url...)
- if err != nil {
- return nil, err
- }
- defer conn.Close()
-
- data := BindThirdReq{}
- data.SiteId = site_id
- data.Dbname = dbname
- data.Openid = openid
- data.Openname = openname
- data.Platform = platform
- data.Unionid = unionid
- data.Avatar = avatar
- data.Userid = user_id
-
- data_json, err := json.Marshal(data)
- if err != nil {
- return nil, err
- }
-
- encryData := crypter.DesEn(string(data_json), DES_KEY)
-
- now_int64 := time.Now().Unix()
-
- 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.BindThird(req, res)
-
- if err != nil {
- return nil, err
- }
-
- return HandleRes(res)
- }
|