From c47ff3d2ec1a11f1817076270221e6189dfa2992 Mon Sep 17 00:00:00 2001 From: guzeng Date: Sat, 23 Oct 2021 18:20:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=85=AC=E5=85=B1=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common.go | 1 + fans.client.go | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 fans.client.go diff --git a/common.go b/common.go index f27545e..18019e6 100644 --- a/common.go +++ b/common.go @@ -67,6 +67,7 @@ type FansReq struct { Req UserId string BusinessId string + Lock bool } func rpc_server_conn(url ...string) (*UserServiceClient, error) { diff --git a/fans.client.go b/fans.client.go new file mode 100644 index 0000000..110c290 --- /dev/null +++ b/fans.client.go @@ -0,0 +1,50 @@ +package userrpc + +import ( + "encoding/json" + "errors" + "strconv" + "time" + + "git.tetele.net/tgo/crypter" + "github.com/golang/protobuf/proto" +) + +/** + * 绑定粉丝 + * 2021/10/23 + * gz + */ +func Fans(site_id, dbname, user_id, business_id string, url ...string) error { + + conn, err := rpc_server_conn(url...) + if err != nil { + return nil, err + } + defer conn.Close() + + data := FansReq{} + data.SiteId = site_id + data.Dbname = dbname + data.UserId = user_id + data.BusinessId = business_id + + data_json, err := json.Marshal(data) + if err != nil { + return nil, err + } + + SetReqData(data) + + res := &Response{} + + err = conn.Fans(req, res) + + if err != nil { + return nil, err + } + + _, err := GetResData(res) + + return err +}