فهرست منبع

重新生成代码

fuwencai 3 سال پیش
والد
کامیت
9cee680ff7

+ 24 - 29
.idea/workspace.xml

@@ -5,27 +5,21 @@
   </component>
   <component name="ChangeListManager">
     <list default="true" id="f5220264-ecf0-4305-ada3-6105184077a7" name="Changes" comment="">
-      <change afterPath="$PROJECT_DIR$/entity/message_mail_box_test.go" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/rpc/internal/logic/countlogic.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/api/internal/handler/handlernamehandler.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/api/internal/handler/messageCenter/handlernamehandler.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/api/internal/handler/routes.go" beforeDir="false" afterPath="$PROJECT_DIR$/api/internal/handler/routes.go" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/api/internal/logic/handlernamelogic.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/api/internal/logic/messageCenter/handlernamelogic.go" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/api/etc/messagecenter.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/api/etc/messagecenter.yaml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/api/internal/config/config.go" beforeDir="false" afterPath="$PROJECT_DIR$/api/internal/config/config.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/api/internal/handler/counthandler.go" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/api/internal/handler/messagehandler.go" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/api/internal/handler/routes.go" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/api/internal/logic/messagelogic.go" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/api/internal/svc/servicecontext.go" beforeDir="false" afterPath="$PROJECT_DIR$/api/internal/svc/servicecontext.go" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/api/internal/types/types.go" beforeDir="false" afterPath="$PROJECT_DIR$/api/internal/types/types.go" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/api/messageCenter.api" beforeDir="false" afterPath="$PROJECT_DIR$/api/messageCenter.api" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/rpc/etc/messagecenter.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/rpc/etc/messagecenter.yaml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/rpc/go.mod" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/rpc/go.sum" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/rpc/internal/config/config.go" beforeDir="false" afterPath="$PROJECT_DIR$/rpc/internal/config/config.go" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/rpc/internal/logic/greetlogic.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/rpc/internal/server/messagecenterserver.go" beforeDir="false" afterPath="$PROJECT_DIR$/rpc/internal/server/messagecenterserver.go" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/rpc/internal/svc/servicecontext.go" beforeDir="false" afterPath="$PROJECT_DIR$/rpc/internal/svc/servicecontext.go" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/rpc/messageCenter.proto" beforeDir="false" afterPath="$PROJECT_DIR$/rpc/messageCenter.proto" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/rpc/messageCenter/messageCenter.pb.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/rpc/messagecenter.go" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/rpc/messagecenterclient/messagecenter.go" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/rpc/messagecenter/messageCenter.pb.go" beforeDir="false" afterPath="$PROJECT_DIR$/rpc/messagecenter/messageCenter.pb.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/rpc/messagecenter/messageCenter_grpc.pb.go" beforeDir="false" afterPath="$PROJECT_DIR$/rpc/messagecenter/messageCenter_grpc.pb.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/rpc/messagecenterclient/messagecenter.go" beforeDir="false" afterPath="$PROJECT_DIR$/rpc/messagecenterclient/messagecenter.go" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -46,6 +40,9 @@
   <component name="Git.Settings">
     <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
   </component>
+  <component name="GoLibraries">
+    <option name="indexEntireGoPath" value="true" />
+  </component>
   <component name="MarkdownSettingsMigration">
     <option name="stateVersion" value="1" />
   </component>
@@ -71,14 +68,15 @@
     "configurable.GoLibrariesConfigurable.is.expanded": "true",
     "go.import.settings.migrated": "true",
     "go.sdk.automatically.set": "true",
-    "last_opened_file_path": "D:/workspace/top_project/SocialPlatform/messageCenter/rpc",
+    "last_opened_file_path": "D:/workspace/top_project/SocialPlatform/messageCenter/rpc/messagecenterclient",
     "nodejs_package_manager_path": "npm",
-    "settings.editor.selected.configurable": "preferences.pluginManager"
+    "settings.editor.selected.configurable": "com.goide.configuration.GoLibrariesConfigurableProvider"
   }
 }]]></component>
   <component name="RecentsManager">
     <key name="CopyFile.RECENT_KEYS">
       <recent name="D:\workspace\top_project\SocialPlatform\messageCenter\rpc\messagecenterclient" />
+      <recent name="D:\workspace\top_project\SocialPlatform\messageCenter\api\etc" />
       <recent name="D:\workspace\top_project\SocialPlatform\messageCenter\rpc\etc" />
       <recent name="D:\workspace\top_project\SocialPlatform\messageCenter\rpc" />
     </key>
@@ -89,7 +87,7 @@
       <recent name="D:\workspace\top_project\SocialPlatform\messageCenter\api" />
     </key>
   </component>
-  <component name="RunManager" selected="Go Test.TestMessage_Get in SocialPlatform.messageCenter/entity">
+  <component name="RunManager" selected="Go Build.go build SocialPlatform.messageCenter/rpc">
     <configuration default="true" type="GoApplicationRunConfiguration" factoryName="Go Application">
       <module name="messageCenter" />
       <working_directory value="$PROJECT_DIR$" />
@@ -99,16 +97,13 @@
       <filePath value="$PROJECT_DIR$" />
       <method v="2" />
     </configuration>
-    <configuration name="TestMessageMailBox_Count in SocialPlatform.messageCenter/entity" type="GoTestRunConfiguration" factoryName="Go Test" temporary="true" nameIsGenerated="true">
+    <configuration name="go build SocialPlatform.messageCenter/rpc" type="GoApplicationRunConfiguration" factoryName="Go Application" temporary="true" nameIsGenerated="true">
       <module name="messageCenter" />
-      <working_directory value="$PROJECT_DIR$/entity" />
-      <root_directory value="$PROJECT_DIR$" />
+      <working_directory value="$PROJECT_DIR$/rpc" />
       <kind value="PACKAGE" />
-      <package value="SocialPlatform.messageCenter/entity" />
+      <package value="SocialPlatform.messageCenter/rpc" />
       <directory value="$PROJECT_DIR$" />
-      <filePath value="$PROJECT_DIR$" />
-      <framework value="gotest" />
-      <pattern value="^\QTestMessageMailBox_Count\E$" />
+      <filePath value="$PROJECT_DIR$/rpc/messagecenter.go" />
       <method v="2" />
     </configuration>
     <configuration name="TestMessageMailBox_Count/case1 in SocialPlatform.messageCenter/entity" type="GoTestRunConfiguration" factoryName="Go Test" temporary="true" nameIsGenerated="true">
@@ -170,7 +165,7 @@
       <method v="2" />
     </configuration>
     <list>
-      <item itemvalue="Go Test.TestMessageMailBox_Count in SocialPlatform.messageCenter/entity" />
+      <item itemvalue="Go Build.go build SocialPlatform.messageCenter/rpc" />
       <item itemvalue="Go Test.TestMessageMailBox_Count/case1 in SocialPlatform.messageCenter/entity" />
       <item itemvalue="Go Test.TestMessageMailBox_GetLast/case1 in SocialPlatform.messageCenter/entity" />
       <item itemvalue="Go Test.TestMessage_Get in SocialPlatform.messageCenter/entity" />
@@ -178,11 +173,11 @@
     </list>
     <recent_temporary>
       <list>
+        <item itemvalue="Go Build.go build SocialPlatform.messageCenter/rpc" />
         <item itemvalue="Go Test.TestMessage_Get in SocialPlatform.messageCenter/entity" />
         <item itemvalue="Go Test.TestMessage_Get/case1 in SocialPlatform.messageCenter/entity" />
         <item itemvalue="Go Test.TestMessageMailBox_GetLast/case1 in SocialPlatform.messageCenter/entity" />
         <item itemvalue="Go Test.TestMessageMailBox_Count/case1 in SocialPlatform.messageCenter/entity" />
-        <item itemvalue="Go Test.TestMessageMailBox_Count in SocialPlatform.messageCenter/entity" />
       </list>
     </recent_temporary>
   </component>

+ 1 - 6
README.md

@@ -9,13 +9,8 @@
 - rpc 生成代码
 `goctl rpc proto -src messageCenter.proto -dir .
 `
-如果goctl版本较高,以上命令可能由于兼容性问题,不能执行成功。
-如果以上命令执行不成功,可以检查以下goctl的版本以及protoc-gen-go的版本
+goctl 1.1.6 
 
-
-`goctl rpc protoc rpc/messageCenter.proto --go_out=rpc/ --go-grpc_out=rpc/ --zrpc_out=rpc`
-
-生成的代码位置和原来的不一致的话需要手动调整一下
 ### 构建 
 
 ### 其他

+ 6 - 0
api/etc/logs.yaml

@@ -0,0 +1,6 @@
+Mode: file
+Path: ./logs
+Level:
+  - info
+  - error
+KeepDays: 10

+ 15 - 1
api/etc/messagecenter.yaml

@@ -1,3 +1,17 @@
-Name: messageCenter
+Name: social-messageCenter
 Host: 0.0.0.0
 Port: 8888
+WebRpcPort: 8016
+Gateway:
+  ServerCode: jyinfo
+  Etcd:
+    - 127.0.0.1:2379
+knowledge:
+  Etcd:
+    Hosts:
+      - 192.168.3.206:2379
+    Key: social-messagecenter.rpc
+  Timeout: 10000
+AppId: 10000
+MaxBytes: 2097152
+Timeout:  500000

+ 10 - 1
api/internal/config/config.go

@@ -1,7 +1,16 @@
 package config
 
-import "github.com/zeromicro/go-zero/rest"
+import (
+	"github.com/zeromicro/go-zero/rest"
+	"github.com/zeromicro/go-zero/zrpc"
+)
 
 type Config struct {
 	rest.RestConf
+	WebRpcPort int64
+	Gateway    struct {
+		ServerCode string
+		Etcd       []string
+	}
+	messageRpc zrpc.RpcClientConf
 }

+ 3 - 3
api/internal/handler/messagehandler.go → api/internal/handler/lastmessagehandler.go

@@ -9,7 +9,7 @@ import (
 	"github.com/zeromicro/go-zero/rest/httpx"
 )
 
-func messageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+func lastMessageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
 	return func(w http.ResponseWriter, r *http.Request) {
 		var req types.GetReq
 		if err := httpx.Parse(r, &req); err != nil {
@@ -17,8 +17,8 @@ func messageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
 			return
 		}
 
-		l := logic.NewMessageLogic(r.Context(), svcCtx)
-		resp, err := l.Message(&req)
+		l := logic.NewLastMessageLogic(r.Context(), svcCtx)
+		resp, err := l.LastMessage(&req)
 		if err != nil {
 			httpx.Error(w, err)
 		} else {

+ 2 - 2
api/internal/handler/routes.go

@@ -19,8 +19,8 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 			},
 			{
 				Method:  http.MethodGet,
-				Path:    "/api/message",
-				Handler: messageHandler(serverCtx),
+				Path:    "/api/message/last",
+				Handler: lastMessageHandler(serverCtx),
 			},
 		},
 	)

+ 5 - 5
api/internal/logic/messagelogic.go → api/internal/logic/lastmessagelogic.go

@@ -9,22 +9,22 @@ import (
 	"github.com/zeromicro/go-zero/core/logx"
 )
 
-type MessageLogic struct {
+type LastMessageLogic struct {
 	logx.Logger
 	ctx    context.Context
 	svcCtx *svc.ServiceContext
 }
 
-func NewMessageLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MessageLogic {
-	return &MessageLogic{
+func NewLastMessageLogic(ctx context.Context, svcCtx *svc.ServiceContext) *LastMessageLogic {
+	return &LastMessageLogic{
 		Logger: logx.WithContext(ctx),
 		ctx:    ctx,
 		svcCtx: svcCtx,
 	}
 }
 
-func (l *MessageLogic) Message(req *types.GetReq) (resp *types.GetRes, err error) {
+func (l *LastMessageLogic) LastMessage(req *types.GetReq) (resp *types.GetRes, err error) {
 	// todo: add your logic here and delete this line
-
+	rpc
 	return
 }

+ 4 - 0
api/internal/svc/servicecontext.go

@@ -1,15 +1,19 @@
 package svc
 
 import (
+	"SocialPlatform.messageCenter/rpc/messagecenterclient"
 	"api/internal/config"
+	"github.com/zeromicro/go-zero/zrpc"
 )
 
 type ServiceContext struct {
 	Config config.Config
+	MessageRpc messagecenterclient.MessageCente
 }
 
 func NewServiceContext(c config.Config) *ServiceContext {
 	return &ServiceContext{
 		Config: c,
+		:jyorderclient.NewJyOrder(zrpc.MustNewClient(c.JyOrder)),
 	}
 }

+ 8 - 0
api/internal/types/types.go

@@ -8,6 +8,10 @@ type Response struct {
 }
 
 type CountReq struct {
+	ReadType  int64  `json:"readType"`  // 已读类型
+	MsgType   int64  `json:"msgType"`   // 消息类型
+	SendId    string `json:"sendId"`    // 发送方id
+	ReceiveId string `json:"receiveId"` // 接收方id
 }
 
 type CountRes struct {
@@ -17,4 +21,8 @@ type GetReq struct {
 }
 
 type GetRes struct {
+	ReadType  int64  `json:"readType"`  // 已读类型
+	MsgType   int64  `json:"msgType"`   // 消息类型
+	SendId    string `json:"sendId"`    // 发送方id
+	ReceiveId string `json:"receiveId"` // 接收方id
 }

+ 10 - 2
api/messageCenter.api

@@ -17,18 +17,26 @@ type response {
 }
 
 type countReq {
+	ReadType  int64  `json:"readType"`  // 已读类型
+	MsgType   int64  `json:"msgType"`   // 消息类型
+	SendId    string `json:"sendId"`    // 发送方id
+	ReceiveId string `json:"receiveId"` // 接收方id
 }
 type countRes {
 }
 type getReq {
 }
 type getRes {
+	ReadType  int64  `json:"readType"`  // 已读类型
+	MsgType   int64  `json:"msgType"`   // 消息类型
+	SendId    string `json:"sendId"`    // 发送方id
+	ReceiveId string `json:"receiveId"` // 接收方id
 }
 service messageCenter {
 	//
 	@handler count
 	get /api/message/count (countReq) returns (countRes)
 	//
-	@handler message
-	get /api/message (getReq) returns (getRes)
+	@handler lastMessage
+	get /api/message/last (getReq) returns (getRes)
 }

+ 1 - 1
rpc/etc/messagecenter.yaml

@@ -3,7 +3,7 @@ ListenOn: 127.0.0.1:8080
 Etcd:
   Hosts:
   - 127.0.0.1:2379
-  Key: messagecenter.rpc
+  Key: social-messagecenter.rpc
 MysqlMain:
   dbName: base_service
   address: 192.168.3.11:3366

+ 1 - 2
rpc/internal/server/messagecenterserver.go

@@ -8,12 +8,11 @@ import (
 
 	"SocialPlatform.messageCenter/rpc/internal/logic"
 	"SocialPlatform.messageCenter/rpc/internal/svc"
-	"SocialPlatform.messageCenter/rpc/messagecenter"
+	"SocialPlatform.messageCenter/rpc/messageCenter"
 )
 
 type MessageCenterServer struct {
 	svcCtx *svc.ServiceContext
-	messageCenter.UnimplementedMessageCenterServer
 }
 
 func NewMessageCenterServer(svcCtx *svc.ServiceContext) *MessageCenterServer {

+ 288 - 310
rpc/messagecenter/messageCenter.pb.go

@@ -1,401 +1,379 @@
 // Code generated by protoc-gen-go. DO NOT EDIT.
-// versions:
-// 	protoc-gen-go v1.28.0
-// 	protoc        v3.19.4
 // source: messageCenter.proto
 
 package messageCenter
 
 import (
-	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
-	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
-	reflect "reflect"
-	sync "sync"
+	context "context"
+	fmt "fmt"
+	proto "github.com/golang/protobuf/proto"
+	grpc "google.golang.org/grpc"
+	codes "google.golang.org/grpc/codes"
+	status "google.golang.org/grpc/status"
+	math "math"
 )
 
-const (
-	// Verify that this generated code is sufficiently up-to-date.
-	_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
-	// Verify that runtime/protoimpl is sufficiently up-to-date.
-	_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
-)
+// Reference imports to suppress errors if they are not otherwise used.
+var _ = proto.Marshal
+var _ = fmt.Errorf
+var _ = math.Inf
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the proto package it is being compiled against.
+// A compilation error at this line likely means your copy of the
+// proto package needs to be updated.
+const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
 
 type CountReq struct {
-	state         protoimpl.MessageState
-	sizeCache     protoimpl.SizeCache
-	unknownFields protoimpl.UnknownFields
-
-	ReadType  int64  `protobuf:"varint,1,opt,name=readType,proto3" json:"readType,omitempty"`  // 已读类型
-	MsgType   int64  `protobuf:"varint,2,opt,name=msgType,proto3" json:"msgType,omitempty"`    // 消息类型
-	SendId    string `protobuf:"bytes,3,opt,name=sendId,proto3" json:"sendId,omitempty"`       // 发送方id
-	ReceiveId string `protobuf:"bytes,4,opt,name=receiveId,proto3" json:"receiveId,omitempty"` // 接收方id
-}
-
-func (x *CountReq) Reset() {
-	*x = CountReq{}
-	if protoimpl.UnsafeEnabled {
-		mi := &file_messageCenter_proto_msgTypes[0]
-		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
-		ms.StoreMessageInfo(mi)
-	}
+	ReadType             int64    `protobuf:"varint,1,opt,name=readType,proto3" json:"readType,omitempty"`
+	MsgType              int64    `protobuf:"varint,2,opt,name=msgType,proto3" json:"msgType,omitempty"`
+	SendId               string   `protobuf:"bytes,3,opt,name=sendId,proto3" json:"sendId,omitempty"`
+	ReceiveId            string   `protobuf:"bytes,4,opt,name=receiveId,proto3" json:"receiveId,omitempty"`
+	XXX_NoUnkeyedLiteral struct{} `json:"-"`
+	XXX_unrecognized     []byte   `json:"-"`
+	XXX_sizecache        int32    `json:"-"`
+}
+
+func (m *CountReq) Reset()         { *m = CountReq{} }
+func (m *CountReq) String() string { return proto.CompactTextString(m) }
+func (*CountReq) ProtoMessage()    {}
+func (*CountReq) Descriptor() ([]byte, []int) {
+	return fileDescriptor_e1ab527c77caa1b6, []int{0}
 }
 
-func (x *CountReq) String() string {
-	return protoimpl.X.MessageStringOf(x)
+func (m *CountReq) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_CountReq.Unmarshal(m, b)
 }
-
-func (*CountReq) ProtoMessage() {}
-
-func (x *CountReq) ProtoReflect() protoreflect.Message {
-	mi := &file_messageCenter_proto_msgTypes[0]
-	if protoimpl.UnsafeEnabled && x != nil {
-		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
-		if ms.LoadMessageInfo() == nil {
-			ms.StoreMessageInfo(mi)
-		}
-		return ms
-	}
-	return mi.MessageOf(x)
+func (m *CountReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_CountReq.Marshal(b, m, deterministic)
 }
-
-// Deprecated: Use CountReq.ProtoReflect.Descriptor instead.
-func (*CountReq) Descriptor() ([]byte, []int) {
-	return file_messageCenter_proto_rawDescGZIP(), []int{0}
+func (m *CountReq) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_CountReq.Merge(m, src)
+}
+func (m *CountReq) XXX_Size() int {
+	return xxx_messageInfo_CountReq.Size(m)
 }
+func (m *CountReq) XXX_DiscardUnknown() {
+	xxx_messageInfo_CountReq.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_CountReq proto.InternalMessageInfo
 
-func (x *CountReq) GetReadType() int64 {
-	if x != nil {
-		return x.ReadType
+func (m *CountReq) GetReadType() int64 {
+	if m != nil {
+		return m.ReadType
 	}
 	return 0
 }
 
-func (x *CountReq) GetMsgType() int64 {
-	if x != nil {
-		return x.MsgType
+func (m *CountReq) GetMsgType() int64 {
+	if m != nil {
+		return m.MsgType
 	}
 	return 0
 }
 
-func (x *CountReq) GetSendId() string {
-	if x != nil {
-		return x.SendId
+func (m *CountReq) GetSendId() string {
+	if m != nil {
+		return m.SendId
 	}
 	return ""
 }
 
-func (x *CountReq) GetReceiveId() string {
-	if x != nil {
-		return x.ReceiveId
+func (m *CountReq) GetReceiveId() string {
+	if m != nil {
+		return m.ReceiveId
 	}
 	return ""
 }
 
 type CountResp struct {
-	state         protoimpl.MessageState
-	sizeCache     protoimpl.SizeCache
-	unknownFields protoimpl.UnknownFields
-
-	Count int64 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"`
+	Count                int64    `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"`
+	XXX_NoUnkeyedLiteral struct{} `json:"-"`
+	XXX_unrecognized     []byte   `json:"-"`
+	XXX_sizecache        int32    `json:"-"`
 }
 
-func (x *CountResp) Reset() {
-	*x = CountResp{}
-	if protoimpl.UnsafeEnabled {
-		mi := &file_messageCenter_proto_msgTypes[1]
-		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
-		ms.StoreMessageInfo(mi)
-	}
+func (m *CountResp) Reset()         { *m = CountResp{} }
+func (m *CountResp) String() string { return proto.CompactTextString(m) }
+func (*CountResp) ProtoMessage()    {}
+func (*CountResp) Descriptor() ([]byte, []int) {
+	return fileDescriptor_e1ab527c77caa1b6, []int{1}
 }
 
-func (x *CountResp) String() string {
-	return protoimpl.X.MessageStringOf(x)
+func (m *CountResp) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_CountResp.Unmarshal(m, b)
 }
-
-func (*CountResp) ProtoMessage() {}
-
-func (x *CountResp) ProtoReflect() protoreflect.Message {
-	mi := &file_messageCenter_proto_msgTypes[1]
-	if protoimpl.UnsafeEnabled && x != nil {
-		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
-		if ms.LoadMessageInfo() == nil {
-			ms.StoreMessageInfo(mi)
-		}
-		return ms
-	}
-	return mi.MessageOf(x)
+func (m *CountResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_CountResp.Marshal(b, m, deterministic)
 }
-
-// Deprecated: Use CountResp.ProtoReflect.Descriptor instead.
-func (*CountResp) Descriptor() ([]byte, []int) {
-	return file_messageCenter_proto_rawDescGZIP(), []int{1}
+func (m *CountResp) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_CountResp.Merge(m, src)
 }
+func (m *CountResp) XXX_Size() int {
+	return xxx_messageInfo_CountResp.Size(m)
+}
+func (m *CountResp) XXX_DiscardUnknown() {
+	xxx_messageInfo_CountResp.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_CountResp proto.InternalMessageInfo
 
-func (x *CountResp) GetCount() int64 {
-	if x != nil {
-		return x.Count
+func (m *CountResp) GetCount() int64 {
+	if m != nil {
+		return m.Count
 	}
 	return 0
 }
 
 type GetReq struct {
-	state         protoimpl.MessageState
-	sizeCache     protoimpl.SizeCache
-	unknownFields protoimpl.UnknownFields
-
-	MsgType   int64  `protobuf:"varint,1,opt,name=msgType,proto3" json:"msgType,omitempty"`    // 消息类型
-	SendId    string `protobuf:"bytes,2,opt,name=sendId,proto3" json:"sendId,omitempty"`       // 发送方id
-	ReceiveId string `protobuf:"bytes,3,opt,name=receiveId,proto3" json:"receiveId,omitempty"` // 接收方id
+	MsgType              int64    `protobuf:"varint,1,opt,name=msgType,proto3" json:"msgType,omitempty"`
+	SendId               string   `protobuf:"bytes,2,opt,name=sendId,proto3" json:"sendId,omitempty"`
+	ReceiveId            string   `protobuf:"bytes,3,opt,name=receiveId,proto3" json:"receiveId,omitempty"`
+	XXX_NoUnkeyedLiteral struct{} `json:"-"`
+	XXX_unrecognized     []byte   `json:"-"`
+	XXX_sizecache        int32    `json:"-"`
 }
 
-func (x *GetReq) Reset() {
-	*x = GetReq{}
-	if protoimpl.UnsafeEnabled {
-		mi := &file_messageCenter_proto_msgTypes[2]
-		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
-		ms.StoreMessageInfo(mi)
-	}
+func (m *GetReq) Reset()         { *m = GetReq{} }
+func (m *GetReq) String() string { return proto.CompactTextString(m) }
+func (*GetReq) ProtoMessage()    {}
+func (*GetReq) Descriptor() ([]byte, []int) {
+	return fileDescriptor_e1ab527c77caa1b6, []int{2}
 }
 
-func (x *GetReq) String() string {
-	return protoimpl.X.MessageStringOf(x)
+func (m *GetReq) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_GetReq.Unmarshal(m, b)
 }
-
-func (*GetReq) ProtoMessage() {}
-
-func (x *GetReq) ProtoReflect() protoreflect.Message {
-	mi := &file_messageCenter_proto_msgTypes[2]
-	if protoimpl.UnsafeEnabled && x != nil {
-		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
-		if ms.LoadMessageInfo() == nil {
-			ms.StoreMessageInfo(mi)
-		}
-		return ms
-	}
-	return mi.MessageOf(x)
+func (m *GetReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_GetReq.Marshal(b, m, deterministic)
 }
-
-// Deprecated: Use GetReq.ProtoReflect.Descriptor instead.
-func (*GetReq) Descriptor() ([]byte, []int) {
-	return file_messageCenter_proto_rawDescGZIP(), []int{2}
+func (m *GetReq) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_GetReq.Merge(m, src)
+}
+func (m *GetReq) XXX_Size() int {
+	return xxx_messageInfo_GetReq.Size(m)
+}
+func (m *GetReq) XXX_DiscardUnknown() {
+	xxx_messageInfo_GetReq.DiscardUnknown(m)
 }
 
-func (x *GetReq) GetMsgType() int64 {
-	if x != nil {
-		return x.MsgType
+var xxx_messageInfo_GetReq proto.InternalMessageInfo
+
+func (m *GetReq) GetMsgType() int64 {
+	if m != nil {
+		return m.MsgType
 	}
 	return 0
 }
 
-func (x *GetReq) GetSendId() string {
-	if x != nil {
-		return x.SendId
+func (m *GetReq) GetSendId() string {
+	if m != nil {
+		return m.SendId
 	}
 	return ""
 }
 
-func (x *GetReq) GetReceiveId() string {
-	if x != nil {
-		return x.ReceiveId
+func (m *GetReq) GetReceiveId() string {
+	if m != nil {
+		return m.ReceiveId
 	}
 	return ""
 }
 
 type GetResp struct {
-	state         protoimpl.MessageState
-	sizeCache     protoimpl.SizeCache
-	unknownFields protoimpl.UnknownFields
+	Content              string   `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"`
+	CreateTime           string   `protobuf:"bytes,2,opt,name=createTime,proto3" json:"createTime,omitempty"`
+	XXX_NoUnkeyedLiteral struct{} `json:"-"`
+	XXX_unrecognized     []byte   `json:"-"`
+	XXX_sizecache        int32    `json:"-"`
+}
+
+func (m *GetResp) Reset()         { *m = GetResp{} }
+func (m *GetResp) String() string { return proto.CompactTextString(m) }
+func (*GetResp) ProtoMessage()    {}
+func (*GetResp) Descriptor() ([]byte, []int) {
+	return fileDescriptor_e1ab527c77caa1b6, []int{3}
+}
+
+func (m *GetResp) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_GetResp.Unmarshal(m, b)
+}
+func (m *GetResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_GetResp.Marshal(b, m, deterministic)
+}
+func (m *GetResp) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_GetResp.Merge(m, src)
+}
+func (m *GetResp) XXX_Size() int {
+	return xxx_messageInfo_GetResp.Size(m)
+}
+func (m *GetResp) XXX_DiscardUnknown() {
+	xxx_messageInfo_GetResp.DiscardUnknown(m)
+}
 
-	Content    string `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"`
-	CreateTime string `protobuf:"bytes,2,opt,name=createTime,proto3" json:"createTime,omitempty"`
+var xxx_messageInfo_GetResp proto.InternalMessageInfo
+
+func (m *GetResp) GetContent() string {
+	if m != nil {
+		return m.Content
+	}
+	return ""
 }
 
-func (x *GetResp) Reset() {
-	*x = GetResp{}
-	if protoimpl.UnsafeEnabled {
-		mi := &file_messageCenter_proto_msgTypes[3]
-		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
-		ms.StoreMessageInfo(mi)
+func (m *GetResp) GetCreateTime() string {
+	if m != nil {
+		return m.CreateTime
 	}
+	return ""
 }
 
-func (x *GetResp) String() string {
-	return protoimpl.X.MessageStringOf(x)
+func init() {
+	proto.RegisterType((*CountReq)(nil), "messageCenter.CountReq")
+	proto.RegisterType((*CountResp)(nil), "messageCenter.CountResp")
+	proto.RegisterType((*GetReq)(nil), "messageCenter.GetReq")
+	proto.RegisterType((*GetResp)(nil), "messageCenter.GetResp")
 }
 
-func (*GetResp) ProtoMessage() {}
+func init() { proto.RegisterFile("messageCenter.proto", fileDescriptor_e1ab527c77caa1b6) }
 
-func (x *GetResp) ProtoReflect() protoreflect.Message {
-	mi := &file_messageCenter_proto_msgTypes[3]
-	if protoimpl.UnsafeEnabled && x != nil {
-		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
-		if ms.LoadMessageInfo() == nil {
-			ms.StoreMessageInfo(mi)
-		}
-		return ms
-	}
-	return mi.MessageOf(x)
+var fileDescriptor_e1ab527c77caa1b6 = []byte{
+	// 265 bytes of a gzipped FileDescriptorProto
+	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0x41, 0x4b, 0xc3, 0x40,
+	0x10, 0x85, 0xd9, 0xc6, 0xa6, 0xcd, 0x80, 0x88, 0xa3, 0xd6, 0x25, 0x88, 0xd4, 0x9c, 0x7a, 0x8a,
+	0xa0, 0x17, 0xf1, 0x68, 0x0e, 0x52, 0xf0, 0x14, 0x7a, 0x10, 0x6f, 0x31, 0x19, 0x4a, 0x0f, 0x49,
+	0xd6, 0x9d, 0xb5, 0xe0, 0x0f, 0xf0, 0x7f, 0x4b, 0xb7, 0x1b, 0xdb, 0x2d, 0xcd, 0xf1, 0xbd, 0x17,
+	0xde, 0x37, 0x79, 0x0b, 0x17, 0x35, 0x31, 0x17, 0x4b, 0xca, 0xa8, 0x31, 0xa4, 0x53, 0xa5, 0x5b,
+	0xd3, 0xe2, 0xa9, 0x67, 0x26, 0x6b, 0x18, 0x67, 0xed, 0x77, 0x63, 0x72, 0xfa, 0xc2, 0x18, 0xc6,
+	0x9a, 0x8a, 0x6a, 0xf1, 0xa3, 0x48, 0x8a, 0xa9, 0x98, 0x05, 0xf9, 0xbf, 0x46, 0x09, 0xa3, 0x9a,
+	0x97, 0x36, 0x1a, 0xd8, 0xa8, 0x93, 0x38, 0x81, 0x90, 0xa9, 0xa9, 0xe6, 0x95, 0x0c, 0xa6, 0x62,
+	0x16, 0xe5, 0x4e, 0xe1, 0x0d, 0x44, 0x9a, 0x4a, 0x5a, 0xad, 0x69, 0x5e, 0xc9, 0x13, 0x1b, 0xed,
+	0x8c, 0xe4, 0x0e, 0x22, 0xc7, 0x65, 0x85, 0x97, 0x30, 0x2c, 0x37, 0xc2, 0x51, 0xb7, 0x22, 0x79,
+	0x87, 0xf0, 0x95, 0xec, 0x61, 0x7b, 0x70, 0xd1, 0x07, 0x1f, 0xf4, 0xc3, 0x83, 0x43, 0x78, 0x06,
+	0x23, 0xdb, 0xcc, 0x6a, 0x53, 0x5d, 0xb6, 0x8d, 0x21, 0x07, 0x8f, 0xf2, 0x4e, 0xe2, 0x2d, 0x40,
+	0xa9, 0xa9, 0x30, 0xb4, 0x58, 0xd5, 0xe4, 0xea, 0xf7, 0x9c, 0x87, 0x5f, 0x01, 0xfe, 0x96, 0xf8,
+	0x0c, 0x43, 0xfb, 0x4f, 0x78, 0x9d, 0xfa, 0xcb, 0x77, 0x0b, 0xc7, 0xf2, 0x78, 0xc0, 0x0a, 0x9f,
+	0xec, 0x49, 0x6f, 0x05, 0x1b, 0xbc, 0x3a, 0xf8, 0x68, 0x3b, 0x42, 0x3c, 0x39, 0x66, 0xb3, 0x7a,
+	0x39, 0xff, 0x38, 0x4b, 0xef, 0xbd, 0xe8, 0x33, 0xb4, 0x4f, 0xfd, 0xf8, 0x17, 0x00, 0x00, 0xff,
+	0xff, 0x91, 0x3b, 0x3d, 0xef, 0x01, 0x02, 0x00, 0x00,
 }
 
-// Deprecated: Use GetResp.ProtoReflect.Descriptor instead.
-func (*GetResp) Descriptor() ([]byte, []int) {
-	return file_messageCenter_proto_rawDescGZIP(), []int{3}
+// Reference imports to suppress errors if they are not otherwise used.
+var _ context.Context
+var _ grpc.ClientConn
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the grpc package it is being compiled against.
+const _ = grpc.SupportPackageIsVersion4
+
+// MessageCenterClient is the client API for MessageCenter service.
+//
+// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
+type MessageCenterClient interface {
+	// 查询数量
+	Count(ctx context.Context, in *CountReq, opts ...grpc.CallOption) (*CountResp, error)
+	// 获取消息
+	GetLast(ctx context.Context, in *GetReq, opts ...grpc.CallOption) (*GetResp, error)
+}
+
+type messageCenterClient struct {
+	cc *grpc.ClientConn
 }
 
-func (x *GetResp) GetContent() string {
-	if x != nil {
-		return x.Content
+func NewMessageCenterClient(cc *grpc.ClientConn) MessageCenterClient {
+	return &messageCenterClient{cc}
+}
+
+func (c *messageCenterClient) Count(ctx context.Context, in *CountReq, opts ...grpc.CallOption) (*CountResp, error) {
+	out := new(CountResp)
+	err := c.cc.Invoke(ctx, "/messageCenter.messageCenter/Count", in, out, opts...)
+	if err != nil {
+		return nil, err
 	}
-	return ""
+	return out, nil
 }
 
-func (x *GetResp) GetCreateTime() string {
-	if x != nil {
-		return x.CreateTime
+func (c *messageCenterClient) GetLast(ctx context.Context, in *GetReq, opts ...grpc.CallOption) (*GetResp, error) {
+	out := new(GetResp)
+	err := c.cc.Invoke(ctx, "/messageCenter.messageCenter/GetLast", in, out, opts...)
+	if err != nil {
+		return nil, err
 	}
-	return ""
+	return out, nil
 }
 
-var File_messageCenter_proto protoreflect.FileDescriptor
-
-var file_messageCenter_proto_rawDesc = []byte{
-	0x0a, 0x13, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e,
-	0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x65,
-	0x6e, 0x74, 0x65, 0x72, 0x22, 0x76, 0x0a, 0x08, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71,
-	0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x61, 0x64, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01,
-	0x28, 0x03, 0x52, 0x08, 0x72, 0x65, 0x61, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07,
-	0x6d, 0x73, 0x67, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x6d,
-	0x73, 0x67, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x49, 0x64,
-	0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x12, 0x1c,
-	0x0a, 0x09, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28,
-	0x09, 0x52, 0x09, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x49, 0x64, 0x22, 0x21, 0x0a, 0x09,
-	0x43, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75,
-	0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22,
-	0x58, 0x0a, 0x06, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x73, 0x67,
-	0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x6d, 0x73, 0x67, 0x54,
-	0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x18, 0x02, 0x20,
-	0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x72,
-	0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09,
-	0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x49, 0x64, 0x22, 0x43, 0x0a, 0x07, 0x47, 0x65, 0x74,
-	0x52, 0x65, 0x73, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18,
-	0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x1e,
-	0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01,
-	0x28, 0x09, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x32, 0x85,
-	0x01, 0x0a, 0x0d, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72,
-	0x12, 0x3a, 0x0a, 0x05, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x17, 0x2e, 0x6d, 0x65, 0x73, 0x73,
-	0x61, 0x67, 0x65, 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x52,
-	0x65, 0x71, 0x1a, 0x18, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x65, 0x6e, 0x74,
-	0x65, 0x72, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x38, 0x0a, 0x07,
-	0x47, 0x65, 0x74, 0x4c, 0x61, 0x73, 0x74, 0x12, 0x15, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67,
-	0x65, 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x16,
-	0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x47,
-	0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x42, 0x11, 0x5a, 0x0f, 0x2e, 0x2f, 0x6d, 0x65, 0x73, 0x73,
-	0x61, 0x67, 0x65, 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
-	0x33,
-}
-
-var (
-	file_messageCenter_proto_rawDescOnce sync.Once
-	file_messageCenter_proto_rawDescData = file_messageCenter_proto_rawDesc
-)
+// MessageCenterServer is the server API for MessageCenter service.
+type MessageCenterServer interface {
+	// 查询数量
+	Count(context.Context, *CountReq) (*CountResp, error)
+	// 获取消息
+	GetLast(context.Context, *GetReq) (*GetResp, error)
+}
+
+// UnimplementedMessageCenterServer can be embedded to have forward compatible implementations.
+type UnimplementedMessageCenterServer struct {
+}
+
+func (*UnimplementedMessageCenterServer) Count(ctx context.Context, req *CountReq) (*CountResp, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method Count not implemented")
+}
+func (*UnimplementedMessageCenterServer) GetLast(ctx context.Context, req *GetReq) (*GetResp, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method GetLast not implemented")
+}
+
+func RegisterMessageCenterServer(s *grpc.Server, srv MessageCenterServer) {
+	s.RegisterService(&_MessageCenter_serviceDesc, srv)
+}
 
-func file_messageCenter_proto_rawDescGZIP() []byte {
-	file_messageCenter_proto_rawDescOnce.Do(func() {
-		file_messageCenter_proto_rawDescData = protoimpl.X.CompressGZIP(file_messageCenter_proto_rawDescData)
-	})
-	return file_messageCenter_proto_rawDescData
-}
-
-var file_messageCenter_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
-var file_messageCenter_proto_goTypes = []interface{}{
-	(*CountReq)(nil),  // 0: messageCenter.CountReq
-	(*CountResp)(nil), // 1: messageCenter.CountResp
-	(*GetReq)(nil),    // 2: messageCenter.GetReq
-	(*GetResp)(nil),   // 3: messageCenter.GetResp
-}
-var file_messageCenter_proto_depIdxs = []int32{
-	0, // 0: messageCenter.messageCenter.Count:input_type -> messageCenter.CountReq
-	2, // 1: messageCenter.messageCenter.GetLast:input_type -> messageCenter.GetReq
-	1, // 2: messageCenter.messageCenter.Count:output_type -> messageCenter.CountResp
-	3, // 3: messageCenter.messageCenter.GetLast:output_type -> messageCenter.GetResp
-	2, // [2:4] is the sub-list for method output_type
-	0, // [0:2] is the sub-list for method input_type
-	0, // [0:0] is the sub-list for extension type_name
-	0, // [0:0] is the sub-list for extension extendee
-	0, // [0:0] is the sub-list for field type_name
-}
-
-func init() { file_messageCenter_proto_init() }
-func file_messageCenter_proto_init() {
-	if File_messageCenter_proto != nil {
-		return
+func _MessageCenter_Count_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(CountReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(MessageCenterServer).Count(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/messageCenter.messageCenter/Count",
 	}
-	if !protoimpl.UnsafeEnabled {
-		file_messageCenter_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*CountReq); i {
-			case 0:
-				return &v.state
-			case 1:
-				return &v.sizeCache
-			case 2:
-				return &v.unknownFields
-			default:
-				return nil
-			}
-		}
-		file_messageCenter_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*CountResp); i {
-			case 0:
-				return &v.state
-			case 1:
-				return &v.sizeCache
-			case 2:
-				return &v.unknownFields
-			default:
-				return nil
-			}
-		}
-		file_messageCenter_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*GetReq); i {
-			case 0:
-				return &v.state
-			case 1:
-				return &v.sizeCache
-			case 2:
-				return &v.unknownFields
-			default:
-				return nil
-			}
-		}
-		file_messageCenter_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*GetResp); i {
-			case 0:
-				return &v.state
-			case 1:
-				return &v.sizeCache
-			case 2:
-				return &v.unknownFields
-			default:
-				return nil
-			}
-		}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(MessageCenterServer).Count(ctx, req.(*CountReq))
 	}
-	type x struct{}
-	out := protoimpl.TypeBuilder{
-		File: protoimpl.DescBuilder{
-			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
-			RawDescriptor: file_messageCenter_proto_rawDesc,
-			NumEnums:      0,
-			NumMessages:   4,
-			NumExtensions: 0,
-			NumServices:   1,
+	return interceptor(ctx, in, info, handler)
+}
+
+func _MessageCenter_GetLast_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(GetReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(MessageCenterServer).GetLast(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/messageCenter.messageCenter/GetLast",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(MessageCenterServer).GetLast(ctx, req.(*GetReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
+var _MessageCenter_serviceDesc = grpc.ServiceDesc{
+	ServiceName: "messageCenter.messageCenter",
+	HandlerType: (*MessageCenterServer)(nil),
+	Methods: []grpc.MethodDesc{
+		{
+			MethodName: "Count",
+			Handler:    _MessageCenter_Count_Handler,
+		},
+		{
+			MethodName: "GetLast",
+			Handler:    _MessageCenter_GetLast_Handler,
 		},
-		GoTypes:           file_messageCenter_proto_goTypes,
-		DependencyIndexes: file_messageCenter_proto_depIdxs,
-		MessageInfos:      file_messageCenter_proto_msgTypes,
-	}.Build()
-	File_messageCenter_proto = out.File
-	file_messageCenter_proto_rawDesc = nil
-	file_messageCenter_proto_goTypes = nil
-	file_messageCenter_proto_depIdxs = nil
+	},
+	Streams:  []grpc.StreamDesc{},
+	Metadata: "messageCenter.proto",
 }

+ 0 - 145
rpc/messagecenter/messageCenter_grpc.pb.go

@@ -1,145 +0,0 @@
-// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
-// versions:
-// - protoc-gen-go-grpc v1.2.0
-// - protoc             v3.19.4
-// source: messageCenter.proto
-
-package messageCenter
-
-import (
-	context "context"
-	grpc "google.golang.org/grpc"
-	codes "google.golang.org/grpc/codes"
-	status "google.golang.org/grpc/status"
-)
-
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the grpc package it is being compiled against.
-// Requires gRPC-Go v1.32.0 or later.
-const _ = grpc.SupportPackageIsVersion7
-
-// MessageCenterClient is the client API for MessageCenter service.
-//
-// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
-type MessageCenterClient interface {
-	// 查询数量
-	Count(ctx context.Context, in *CountReq, opts ...grpc.CallOption) (*CountResp, error)
-	// 获取消息
-	GetLast(ctx context.Context, in *GetReq, opts ...grpc.CallOption) (*GetResp, error)
-}
-
-type messageCenterClient struct {
-	cc grpc.ClientConnInterface
-}
-
-func NewMessageCenterClient(cc grpc.ClientConnInterface) MessageCenterClient {
-	return &messageCenterClient{cc}
-}
-
-func (c *messageCenterClient) Count(ctx context.Context, in *CountReq, opts ...grpc.CallOption) (*CountResp, error) {
-	out := new(CountResp)
-	err := c.cc.Invoke(ctx, "/messageCenter.messageCenter/Count", in, out, opts...)
-	if err != nil {
-		return nil, err
-	}
-	return out, nil
-}
-
-func (c *messageCenterClient) GetLast(ctx context.Context, in *GetReq, opts ...grpc.CallOption) (*GetResp, error) {
-	out := new(GetResp)
-	err := c.cc.Invoke(ctx, "/messageCenter.messageCenter/GetLast", in, out, opts...)
-	if err != nil {
-		return nil, err
-	}
-	return out, nil
-}
-
-// MessageCenterServer is the server API for MessageCenter service.
-// All implementations must embed UnimplementedMessageCenterServer
-// for forward compatibility
-type MessageCenterServer interface {
-	// 查询数量
-	Count(context.Context, *CountReq) (*CountResp, error)
-	// 获取消息
-	GetLast(context.Context, *GetReq) (*GetResp, error)
-	mustEmbedUnimplementedMessageCenterServer()
-}
-
-// UnimplementedMessageCenterServer must be embedded to have forward compatible implementations.
-type UnimplementedMessageCenterServer struct {
-}
-
-func (UnimplementedMessageCenterServer) Count(context.Context, *CountReq) (*CountResp, error) {
-	return nil, status.Errorf(codes.Unimplemented, "method Count not implemented")
-}
-func (UnimplementedMessageCenterServer) GetLast(context.Context, *GetReq) (*GetResp, error) {
-	return nil, status.Errorf(codes.Unimplemented, "method GetLast not implemented")
-}
-func (UnimplementedMessageCenterServer) mustEmbedUnimplementedMessageCenterServer() {}
-
-// UnsafeMessageCenterServer may be embedded to opt out of forward compatibility for this service.
-// Use of this interface is not recommended, as added methods to MessageCenterServer will
-// result in compilation errors.
-type UnsafeMessageCenterServer interface {
-	mustEmbedUnimplementedMessageCenterServer()
-}
-
-func RegisterMessageCenterServer(s grpc.ServiceRegistrar, srv MessageCenterServer) {
-	s.RegisterService(&MessageCenter_ServiceDesc, srv)
-}
-
-func _MessageCenter_Count_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
-	in := new(CountReq)
-	if err := dec(in); err != nil {
-		return nil, err
-	}
-	if interceptor == nil {
-		return srv.(MessageCenterServer).Count(ctx, in)
-	}
-	info := &grpc.UnaryServerInfo{
-		Server:     srv,
-		FullMethod: "/messageCenter.messageCenter/Count",
-	}
-	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
-		return srv.(MessageCenterServer).Count(ctx, req.(*CountReq))
-	}
-	return interceptor(ctx, in, info, handler)
-}
-
-func _MessageCenter_GetLast_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
-	in := new(GetReq)
-	if err := dec(in); err != nil {
-		return nil, err
-	}
-	if interceptor == nil {
-		return srv.(MessageCenterServer).GetLast(ctx, in)
-	}
-	info := &grpc.UnaryServerInfo{
-		Server:     srv,
-		FullMethod: "/messageCenter.messageCenter/GetLast",
-	}
-	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
-		return srv.(MessageCenterServer).GetLast(ctx, req.(*GetReq))
-	}
-	return interceptor(ctx, in, info, handler)
-}
-
-// MessageCenter_ServiceDesc is the grpc.ServiceDesc for MessageCenter service.
-// It's only intended for direct use with grpc.RegisterService,
-// and not to be introspected or modified (even as a copy)
-var MessageCenter_ServiceDesc = grpc.ServiceDesc{
-	ServiceName: "messageCenter.messageCenter",
-	HandlerType: (*MessageCenterServer)(nil),
-	Methods: []grpc.MethodDesc{
-		{
-			MethodName: "Count",
-			Handler:    _MessageCenter_Count_Handler,
-		},
-		{
-			MethodName: "GetLast",
-			Handler:    _MessageCenter_GetLast_Handler,
-		},
-	},
-	Streams:  []grpc.StreamDesc{},
-	Metadata: "messageCenter.proto",
-}

+ 16 - 9
rpc/messagecenterclient/messagecenter.go

@@ -1,21 +1,28 @@
 // Code generated by goctl. DO NOT EDIT!
 // Source: messageCenter.proto
 
+//go:generate mockgen -destination ./messagecenter_mock.go -package messagecenter -source $GOFILE
+
 package messagecenterclient
 
 import (
 	"context"
 
+	"SocialPlatform.messageCenter/rpc/messageCenter"
 	"github.com/zeromicro/go-zero/zrpc"
-	"google.golang.org/grpc"
 )
 
 type (
+	GetResp   = messageCenter.GetResp
+	CountReq  = messageCenter.CountReq
+	CountResp = messageCenter.CountResp
+	GetReq    = messageCenter.GetReq
+
 	MessageCenter interface {
 		//  查询数量
-		Count(ctx context.Context, in *CountReq, opts ...grpc.CallOption) (*CountResp, error)
+		Count(ctx context.Context, in *CountReq) (*CountResp, error)
 		//  获取消息
-		GetLast(ctx context.Context, in *GetReq, opts ...grpc.CallOption) (*GetResp, error)
+		GetLast(ctx context.Context, in *GetReq) (*GetResp, error)
 	}
 
 	defaultMessageCenter struct {
@@ -30,13 +37,13 @@ func NewMessageCenter(cli zrpc.Client) MessageCenter {
 }
 
 //  查询数量
-func (m *defaultMessageCenter) Count(ctx context.Context, in *CountReq, opts ...grpc.CallOption) (*CountResp, error) {
-	client := NewMessageCenterClient(m.cli.Conn())
-	return client.Count(ctx, in, opts...)
+func (m *defaultMessageCenter) Count(ctx context.Context, in *CountReq) (*CountResp, error) {
+	client := messageCenter.NewMessageCenterClient(m.cli.Conn())
+	return client.Count(ctx, in)
 }
 
 //  获取消息
-func (m *defaultMessageCenter) GetLast(ctx context.Context, in *GetReq, opts ...grpc.CallOption) (*GetResp, error) {
-	client := NewMessageCenterClient(m.cli.Conn())
-	return client.GetLast(ctx, in, opts...)
+func (m *defaultMessageCenter) GetLast(ctx context.Context, in *GetReq) (*GetResp, error) {
+	client := messageCenter.NewMessageCenterClient(m.cli.Conn())
+	return client.GetLast(ctx, in)
 }