Browse Source

增加消息推送接口

master
lijianbin 3 years ago
parent
commit
c0058b8a9f
4 changed files with 34 additions and 26 deletions
  1. +26
    -20
      common.go
  2. +3
    -2
      go.mod
  3. +4
    -4
      go.sum
  4. +1
    -0
      msg.proto

+ 26
- 20
common.go View File

@ -3,35 +3,41 @@ package msgrpc
const DES_KEY = "msgsirpc" const DES_KEY = "msgsirpc"
type Req struct { type Req struct {
SiteId string
Dbname string
SiteId string
Dbname string
} }
type MsgBody struct { type MsgBody struct {
Req
Platform string
BusinessId string
Domainname string
Type string
Data string
OrderSn string
Memo string
Req
Platform string
BusinessId string
Domainname string
Type string
Data string
OrderSn string
Memo string
} }
type MsgSend struct { type MsgSend struct {
Id string
Id string
}
type NoticeSend struct {
Req
ManagerId string
TemplateData map[string]string
} }
func rpc_server_conn(url ...string) (*MsgRpcServiceClient, error) { func rpc_server_conn(url ...string) (*MsgRpcServiceClient, error) {
var wx_rpc_url string = "127.0.0.1:7954"
if len(url) > 0 && url[0] != "" {
wx_rpc_url = url[0]
}
conn, _, err := DialMsgRpcService("tcp", wx_rpc_url)
if err != nil {
return nil, err
}
var wx_rpc_url string = "127.0.0.1:7954"
if len(url) > 0 && url[0] != "" {
wx_rpc_url = url[0]
}
conn, _, err := DialMsgRpcService("tcp", wx_rpc_url)
if err != nil {
return nil, err
}
return conn, nil
return conn, nil
} }

+ 3
- 2
go.mod View File

@ -3,8 +3,9 @@ module git.tetele.net/tgo/msgrpc
go 1.14 go 1.14
require ( require (
git.tetele.net/tgo/crypter v0.2.2 // indirect
github.com/chai2010/protorpc v1.0.0 // indirect
git.tetele.net/tgo/crypter v0.2.2
github.com/chai2010/protorpc v1.1.3
github.com/golang/protobuf v1.0.0
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a // indirect golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
) )

+ 4
- 4
go.sum View File

@ -1,11 +1,11 @@
git.tetele.net/tgo/crypter v0.2.2 h1:YMQJh2Gj5Po4ZfelJUmXBKi01UbmtiSy3bmqRfnYQMo= git.tetele.net/tgo/crypter v0.2.2 h1:YMQJh2Gj5Po4ZfelJUmXBKi01UbmtiSy3bmqRfnYQMo=
git.tetele.net/tgo/crypter v0.2.2/go.mod h1:vfvRLZA8+lHNgNXneOcgvVhDyuv25ZRb+C6xHOmXNx0= git.tetele.net/tgo/crypter v0.2.2/go.mod h1:vfvRLZA8+lHNgNXneOcgvVhDyuv25ZRb+C6xHOmXNx0=
github.com/chai2010/protorpc v1.0.0 h1:aJ45G9sl1utSKo35EqnBSTs5jqTpdJDJAuZMMYPAtFo=
github.com/chai2010/protorpc v1.0.0/go.mod h1:woR3WwjaQDqFjlzdVsFEKiK5Ur12QL8mYxVPjfr5z54=
github.com/chai2010/protorpc v1.1.3 h1:VJK5hIoZn0XCGol0GmbxZkUG6FbTI5LP2Lam6RVd15w=
github.com/chai2010/protorpc v1.1.3/go.mod h1:/wO0kiyVdu7ug8dCMrA2yDr2vLfyhsLEuzLa9J2HJ+I=
github.com/golang/protobuf v1.0.0 h1:lsek0oXi8iFE9L+EXARyHIjU5rlWIhhTkjDz3vHhWWQ= github.com/golang/protobuf v1.0.0 h1:lsek0oXi8iFE9L+EXARyHIjU5rlWIhhTkjDz3vHhWWQ=
github.com/golang/protobuf v1.0.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.0.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/snappy v0.0.0-20170215233205-553a64147049 h1:K9KHZbXKpGydfDN0aZrsoHpLJlZsBrGMFWbgLDGnPZk=
github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.3 h1:fHPg5GQYlCeLIPB9BZqMVR5nR9A+IM5zcgeTdjMYmLA=
github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a h1:kr2P4QFmQr29mSLA43kwrOcgcReGTfbE9N577tCTuBc= golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a h1:kr2P4QFmQr29mSLA43kwrOcgcReGTfbE9N577tCTuBc=
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=


+ 1
- 0
msg.proto View File

@ -19,4 +19,5 @@ message Response {
// rpc方法 // rpc方法
service MsgRpcService { service MsgRpcService {
rpc sendMsg (Request) returns (Response); // rpc sendMsg (Request) returns (Response); //
rpc sendNotcie (Request) returns (Response); //
} }

Loading…
Cancel
Save