Browse Source

增加公共方法

master v0.8.2
guzeng 3 years ago
parent
commit
c47ff3d2ec
2 changed files with 51 additions and 0 deletions
  1. +1
    -0
      common.go
  2. +50
    -0
      fans.client.go

+ 1
- 0
common.go View File

@ -67,6 +67,7 @@ type FansReq struct {
Req
UserId string
BusinessId string
Lock bool
}
func rpc_server_conn(url ...string) (*UserServiceClient, error) {


+ 50
- 0
fans.client.go View File

@ -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
}

Loading…
Cancel
Save