Ver código fonte

Merge branch 'feature/v1.2.6' into dev/v1.2.6_rjj

renjiaojiao 2 anos atrás
pai
commit
7ce6906cc1

+ 28 - 0
api/messagecenter/internal/handler/oneuserconversationhandler.go

@@ -0,0 +1,28 @@
+package handler
+
+import (
+	"net/http"
+
+	"bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/api/messagecenter/internal/logic"
+	"bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/api/messagecenter/internal/svc"
+	"bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/api/messagecenter/internal/types"
+	"github.com/zeromicro/go-zero/rest/httpx"
+)
+
+func oneUserConversationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.OneUserConversationReq
+		if err := httpx.Parse(r, &req); err != nil {
+			httpx.Error(w, err)
+			return
+		}
+
+		l := logic.NewOneUserConversationLogic(r.Context(), svcCtx)
+		resp, err := l.OneUserConversation(&req)
+		if err != nil {
+			httpx.Error(w, err)
+		} else {
+			httpx.OkJson(w, resp)
+		}
+	}
+}

+ 5 - 0
api/messagecenter/internal/handler/routes.go

@@ -72,6 +72,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 				Path:    "/message/oneUserPosition",
 				Handler: oneUserPositionHandler(serverCtx),
 			},
+			{
+				Method:  http.MethodPost,
+				Path:    "/message/oneUserConversation",
+				Handler: oneUserConversationHandler(serverCtx),
+			},
 		},
 	)
 }

+ 7 - 1
api/messagecenter/internal/logic/messageaddlogic.go

@@ -53,13 +53,19 @@ func (l *MessageAddLogic) MessageAdd(req *types.MessageEntity) (*types.CommonRes
 	if req.SendId == "" {
 		sendId = req.PositionId
 	}
+	typ := func(typ int64) int64 {
+		if typ == 5 || typ == 6 {
+			return 1
+		}
+		return typ
+	}(req.Type)
 	resp, err := l.svcCtx.Message.SaveMessage(l.ctx, &messagecenter.MessageEntity{
 		OwnType:     req.OwnType,
 		Title:       req.Title,
 		SendId:      sendId,
 		Content:     quitl.ObjToString(quitl.If(req.Type == 3 || req.Type == 4 || req.Type == 5, fsw.Repl(req.Content), htmlFilter.Sanitize(fsw.Repl(req.Content)))),
 		Item:        req.Item,
-		Type:        quitl.Int64All(quitl.If(req.Type == 5, 1, req.Type)),
+		Type:        typ,
 		Link:        req.Link,
 		Appid:       req.Appid,
 		ItemType:    req.ItemType,

+ 44 - 0
api/messagecenter/internal/logic/oneuserconversationlogic.go

@@ -0,0 +1,44 @@
+package logic
+
+import (
+	quitl "app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/encrypt"
+	"bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/messagecenter"
+	"context"
+
+	"bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/api/messagecenter/internal/svc"
+	"bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/api/messagecenter/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type OneUserConversationLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewOneUserConversationLogic(ctx context.Context, svcCtx *svc.ServiceContext) *OneUserConversationLogic {
+	return &OneUserConversationLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *OneUserConversationLogic) OneUserConversation(req *types.OneUserConversationReq) (resp *types.CommonRes, err error) {
+	oneUserPositionReq := &messagecenter.OneUserConversationReq{
+		EntId:         req.EntId,
+		YouPositionId: quitl.Int64All(encrypt.SE.Decode4Hex(req.YouPositionId)),
+		Appid:         req.Appid,
+		MyPositionId:  req.MyPositionId,
+	}
+	oneResp, err := l.svcCtx.Message.OneUserConversation(l.ctx, oneUserPositionReq)
+	if err != nil {
+		return nil, err
+	}
+	return &types.CommonRes{
+		Error_msg:  oneResp.ErrorMsg,
+		Error_code: int(oneResp.ErrorCode),
+	}, nil
+}

+ 7 - 0
api/messagecenter/internal/types/types.go

@@ -121,3 +121,10 @@ type OneUserPositionReq struct {
 	EntId      int64  `header:"entId,optional"`
 	Appid      string `header:"appId"`
 }
+
+type OneUserConversationReq struct {
+	MyPositionId  int64  `header:"positionId"`
+	EntId         int64  `header:"entId,optional"`
+	Appid         string `header:"appId"`
+	YouPositionId string `json:"youPositionId"`
+}

+ 10 - 0
api/messagecenter/messagecenter.api

@@ -111,6 +111,14 @@ type OneUserPositionReq {
 	EntId      int64  `header:"entId,optional"`
 	Appid      string `header:"appId"`
 }
+
+type OneUserConversationReq {
+	MyPositionId  int64  `header:"positionId"`
+	EntId         int64  `header:"entId,optional"`
+	Appid         string `header:"appId"`
+	YouPositionId string `json:"youPositionId"`
+}
+
 service messagecenter-api {
 	@handler messageCount
 	post /message/messageCount (CountReq) returns (CommonRes);
@@ -136,4 +144,6 @@ service messagecenter-api {
 	post /message/conversationList (UserReq) returns (CommonRes);
 	@handler oneUserPosition // 1v1会话职位
 	post /message/oneUserPosition (OneUserPositionReq) returns (CommonRes);
+	@handler oneUserConversation // 1v1首次创建会话汇总表信息
+	post /message/oneUserConversation (OneUserConversationReq) returns (CommonRes);
 }

+ 1 - 0
entity/util.go

@@ -32,6 +32,7 @@ const (
 	SOCIALIZE_CUSTOMER_SERVICE_USER = "socialize_customer_service_user"
 	Socialize_summary               = "socialize_summary"
 	Socialize_customer_service_user = "socialize_customer_service_user"
+	UserRoleOne                     = "企业管理员"
 )
 const (
 	SUCCESS_CODE = int64(0)

+ 35 - 0
rpc/messagecenter/internal/logic/oneuserconversationlogic.go

@@ -0,0 +1,35 @@
+package logic
+
+import (
+	"bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service"
+	"context"
+
+	"bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/internal/svc"
+	"bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/messagecenter"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type OneUserConversationLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewOneUserConversationLogic(ctx context.Context, svcCtx *svc.ServiceContext) *OneUserConversationLogic {
+	return &OneUserConversationLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+// 1v1首次创建会话汇总表信息
+func (l *OneUserConversationLogic) OneUserConversation(in *messagecenter.OneUserConversationReq) (*messagecenter.CurrencyResp, error) {
+	// todo: add your logic here and delete this line
+	errorMsg := service.OneCreatingSession(in)
+	if errorMsg != "" {
+		return &messagecenter.CurrencyResp{ErrorCode: -1, ErrorMsg: errorMsg}, nil
+	}
+	return &messagecenter.CurrencyResp{}, nil
+}

+ 6 - 1
rpc/messagecenter/internal/logic/userlistlogic.go

@@ -39,7 +39,12 @@ func (l *UserListLogic) UserList(in *messagecenter.UserReq) (*messagecenter.User
 	var result = []*messagecenter.UserEntity{}
 	if data != nil && len(*data) > 0 {
 		for _, v := range *data {
-			tim, _ := time.ParseInLocation(util.Date_Full_Layout, quitl.InterfaceToStr(v["create_time"]), time.Local)
+			var tim time.Time
+			if quitl.InterfaceToStr(v["create_time"]) != "" {
+				tim, _ = time.ParseInLocation(util.Date_Full_Layout, quitl.InterfaceToStr(v["create_time"]), time.Local)
+			} else {
+				tim, _ = time.ParseInLocation(util.Date_Full_Layout, quitl.InterfaceToStr(v["timestamp"]), time.Local)
+			}
 			groupMember, _ := v["groupMember"].([]string)
 			userResp := messagecenter.UserEntity{
 				Name:        quitl.ObjToString(v["name"]),

+ 6 - 0
rpc/messagecenter/internal/server/messagecenterserver.go

@@ -99,3 +99,9 @@ func (s *MessageCenterServer) OneUserPosition(ctx context.Context, in *messagece
 	l := logic.NewOneUserPositionLogic(ctx, s.svcCtx)
 	return l.OneUserPosition(in)
 }
+
+// 1v1首次创建会话汇总表信息
+func (s *MessageCenterServer) OneUserConversation(ctx context.Context, in *messagecenter.OneUserConversationReq) (*messagecenter.CurrencyResp, error) {
+	l := logic.NewOneUserConversationLogic(ctx, s.svcCtx)
+	return l.OneUserConversation(in)
+}

+ 9 - 0
rpc/messagecenter/messagecenter.proto

@@ -196,6 +196,13 @@ message OneUserPositionResp {
   string       position = 3;
 }
 
+//聊天保存
+message OneUserConversationReq {
+  int64 myPositionId = 1;
+  int64 entId = 2;
+  string        appid = 3;
+  int64 youPositionId =4;
+}
 service messageCenter {
   // 查询数量
   rpc Count(CountReq) returns(CountResp);
@@ -223,4 +230,6 @@ service messageCenter {
   rpc GroupChat(MessageSaveReq)returns(CommonReq);
   // 1v1会话职位
   rpc OneUserPosition(OneUserPositionReq)returns(OneUserPositionResp);
+      // 1v1首次创建会话汇总表信息
+    rpc OneUserConversation(OneUserConversationReq) returns (CurrencyResp);
 }

+ 8 - 0
rpc/messagecenter/messagecenter/messagecenter.go

@@ -38,6 +38,8 @@ type (
 		GroupChat(ctx context.Context, in *MessageSaveReq, opts ...grpc.CallOption) (*CommonReq, error)
 		//  1v1会话职位
 		OneUserPosition(ctx context.Context, in *OneUserPositionReq, opts ...grpc.CallOption) (*OneUserPositionResp, error)
+		//  1v1首次创建会话汇总表信息
+		OneUserConversation(ctx context.Context, in *OneUserConversationReq, opts ...grpc.CallOption) (*CurrencyResp, error)
 	}
 
 	defaultMessageCenter struct {
@@ -128,3 +130,9 @@ func (m *defaultMessageCenter) OneUserPosition(ctx context.Context, in *OneUserP
 	client := NewMessageCenterClient(m.cli.Conn())
 	return client.OneUserPosition(ctx, in, opts...)
 }
+
+// 1v1首次创建会话汇总表信息
+func (m *defaultMessageCenter) OneUserConversation(ctx context.Context, in *OneUserConversationReq, opts ...grpc.CallOption) (*CurrencyResp, error) {
+	client := NewMessageCenterClient(m.cli.Conn())
+	return client.OneUserConversation(ctx, in, opts...)
+}

+ 205 - 103
rpc/messagecenter/messagecenter/messagecenter.pb.go

@@ -1976,6 +1976,78 @@ func (x *OneUserPositionResp) GetPosition() string {
 	return ""
 }
 
+// 聊天保存
+type OneUserConversationReq struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	MyPositionId  int64  `protobuf:"varint,1,opt,name=myPositionId,proto3" json:"myPositionId,omitempty"`
+	EntId         int64  `protobuf:"varint,2,opt,name=entId,proto3" json:"entId,omitempty"`
+	Appid         string `protobuf:"bytes,3,opt,name=appid,proto3" json:"appid,omitempty"`
+	YouPositionId int64  `protobuf:"varint,4,opt,name=youPositionId,proto3" json:"youPositionId,omitempty"`
+}
+
+func (x *OneUserConversationReq) Reset() {
+	*x = OneUserConversationReq{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_messagecenter_proto_msgTypes[22]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *OneUserConversationReq) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*OneUserConversationReq) ProtoMessage() {}
+
+func (x *OneUserConversationReq) ProtoReflect() protoreflect.Message {
+	mi := &file_messagecenter_proto_msgTypes[22]
+	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)
+}
+
+// Deprecated: Use OneUserConversationReq.ProtoReflect.Descriptor instead.
+func (*OneUserConversationReq) Descriptor() ([]byte, []int) {
+	return file_messagecenter_proto_rawDescGZIP(), []int{22}
+}
+
+func (x *OneUserConversationReq) GetMyPositionId() int64 {
+	if x != nil {
+		return x.MyPositionId
+	}
+	return 0
+}
+
+func (x *OneUserConversationReq) GetEntId() int64 {
+	if x != nil {
+		return x.EntId
+	}
+	return 0
+}
+
+func (x *OneUserConversationReq) GetAppid() string {
+	if x != nil {
+		return x.Appid
+	}
+	return ""
+}
+
+func (x *OneUserConversationReq) GetYouPositionId() int64 {
+	if x != nil {
+		return x.YouPositionId
+	}
+	return 0
+}
+
 var File_messagecenter_proto protoreflect.FileDescriptor
 
 var file_messagecenter_proto_rawDesc = []byte{
@@ -2247,71 +2319,86 @@ var file_messagecenter_proto_rawDesc = []byte{
 	0x6f, 0x72, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x72,
 	0x72, 0x6f, 0x72, 0x4d, 0x73, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69,
 	0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69,
-	0x6f, 0x6e, 0x32, 0xe9, 0x07, 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, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x43, 0x6f,
-	0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x18, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
-	0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70,
-	0x12, 0x3b, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x16, 0x2e, 0x6d,
-	0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x55, 0x73, 0x65,
-	0x72, 0x52, 0x65, 0x71, 0x1a, 0x17, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x63, 0x65,
-	0x6e, 0x74, 0x65, 0x72, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x44, 0x0a,
-	0x0b, 0x46, 0x69, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x19, 0x2e, 0x6d,
-	0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x65, 0x73,
-	0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x1a, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67,
-	0x65, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52,
-	0x65, 0x73, 0x70, 0x12, 0x4b, 0x0a, 0x0b, 0x53, 0x61, 0x76, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61,
-	0x67, 0x65, 0x12, 0x1c, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x63, 0x65, 0x6e, 0x74,
-	0x65, 0x72, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79,
-	0x1a, 0x1e, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72,
-	0x2e, 0x53, 0x61, 0x76, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70,
-	0x12, 0x52, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x74, 0x53, 0x65,
-	0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x63,
-	0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x43, 0x68, 0x61, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f,
-	0x6e, 0x52, 0x65, 0x71, 0x1a, 0x1e, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x63, 0x65,
-	0x6e, 0x74, 0x65, 0x72, 0x2e, 0x43, 0x68, 0x61, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e,
-	0x52, 0x65, 0x73, 0x70, 0x12, 0x52, 0x0a, 0x10, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x43, 0x68, 0x61,
-	0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61,
-	0x67, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x53, 0x65,
-	0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x1e, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61,
-	0x67, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x43, 0x68, 0x61, 0x74, 0x53, 0x65, 0x73,
-	0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x4f, 0x0a, 0x10, 0x53, 0x61, 0x76, 0x65,
-	0x41, 0x75, 0x74, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x4d, 0x73, 0x67, 0x12, 0x1f, 0x2e, 0x6d,
-	0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x53, 0x61, 0x76,
-	0x65, 0x41, 0x75, 0x74, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x1a, 0x2e,
-	0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x65,
-	0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x4a, 0x0a, 0x0e, 0x55, 0x70, 0x64,
-	0x61, 0x74, 0x65, 0x52, 0x65, 0x61, 0x64, 0x42, 0x79, 0x49, 0x64, 0x12, 0x1b, 0x2e, 0x6d, 0x65,
-	0x73, 0x73, 0x61, 0x67, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x61, 0x64,
-	0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x1b, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61,
-	0x67, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63,
-	0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x4e, 0x0a, 0x0f, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61,
-	0x77, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1e, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61,
-	0x67, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x57, 0x69, 0x74,
-	0x68, 0x64, 0x72, 0x61, 0x77, 0x52, 0x65, 0x71, 0x1a, 0x1b, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61,
-	0x67, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63,
-	0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x4a, 0x0a, 0x0f, 0x41, 0x70, 0x70, 0x72, 0x61, 0x69, 0x73,
-	0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61,
-	0x67, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x41, 0x70, 0x70, 0x72, 0x61, 0x69, 0x73,
-	0x65, 0x52, 0x65, 0x71, 0x1a, 0x1b, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x63, 0x65,
-	0x6e, 0x74, 0x65, 0x72, 0x2e, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x52, 0x65, 0x73,
-	0x70, 0x12, 0x4b, 0x0a, 0x10, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f,
-	0x6e, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1e, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x63,
-	0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69,
-	0x6f, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x17, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x63,
+	0x6f, 0x6e, 0x22, 0x8e, 0x01, 0x0a, 0x16, 0x4f, 0x6e, 0x65, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6f,
+	0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x22, 0x0a,
+	0x0c, 0x6d, 0x79, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20,
+	0x01, 0x28, 0x03, 0x52, 0x0c, 0x6d, 0x79, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49,
+	0x64, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03,
+	0x52, 0x05, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x70, 0x70, 0x69, 0x64,
+	0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x70, 0x70, 0x69, 0x64, 0x12, 0x24, 0x0a,
+	0x0d, 0x79, 0x6f, 0x75, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x04,
+	0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x79, 0x6f, 0x75, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f,
+	0x6e, 0x49, 0x64, 0x32, 0xc4, 0x08, 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, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x43,
+	0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x18, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67,
+	0x65, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73,
+	0x70, 0x12, 0x3b, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x16, 0x2e,
+	0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x55, 0x73,
+	0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x17, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x63,
 	0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x44,
-	0x0a, 0x09, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x43, 0x68, 0x61, 0x74, 0x12, 0x1d, 0x2e, 0x6d, 0x65,
-	0x73, 0x73, 0x61, 0x67, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x65, 0x73, 0x73,
-	0x61, 0x67, 0x65, 0x53, 0x61, 0x76, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x18, 0x2e, 0x6d, 0x65, 0x73,
-	0x73, 0x61, 0x67, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f,
-	0x6e, 0x52, 0x65, 0x71, 0x12, 0x58, 0x0a, 0x0f, 0x4f, 0x6e, 0x65, 0x55, 0x73, 0x65, 0x72, 0x50,
-	0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67,
-	0x65, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x4f, 0x6e, 0x65, 0x55, 0x73, 0x65, 0x72, 0x50,
-	0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x22, 0x2e, 0x6d, 0x65, 0x73,
-	0x73, 0x61, 0x67, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x4f, 0x6e, 0x65, 0x55, 0x73,
-	0x65, 0x72, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x42, 0x11,
-	0x5a, 0x0f, 0x2e, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x65,
-	0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+	0x0a, 0x0b, 0x46, 0x69, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x19, 0x2e,
+	0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x65,
+	0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x1a, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61,
+	0x67, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
+	0x52, 0x65, 0x73, 0x70, 0x12, 0x4b, 0x0a, 0x0b, 0x53, 0x61, 0x76, 0x65, 0x4d, 0x65, 0x73, 0x73,
+	0x61, 0x67, 0x65, 0x12, 0x1c, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x63, 0x65, 0x6e,
+	0x74, 0x65, 0x72, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x74, 0x69, 0x74,
+	0x79, 0x1a, 0x1e, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x65,
+	0x72, 0x2e, 0x53, 0x61, 0x76, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73,
+	0x70, 0x12, 0x52, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x74, 0x53,
+	0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
+	0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x43, 0x68, 0x61, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69,
+	0x6f, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x1e, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x63,
+	0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x43, 0x68, 0x61, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f,
+	0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x52, 0x0a, 0x10, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x43, 0x68,
+	0x61, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x2e, 0x6d, 0x65, 0x73, 0x73,
+	0x61, 0x67, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x53,
+	0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x1e, 0x2e, 0x6d, 0x65, 0x73, 0x73,
+	0x61, 0x67, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x43, 0x68, 0x61, 0x74, 0x53, 0x65,
+	0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x4f, 0x0a, 0x10, 0x53, 0x61, 0x76,
+	0x65, 0x41, 0x75, 0x74, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x4d, 0x73, 0x67, 0x12, 0x1f, 0x2e,
+	0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x53, 0x61,
+	0x76, 0x65, 0x41, 0x75, 0x74, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x1a,
+	0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x4d,
+	0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x4a, 0x0a, 0x0e, 0x55, 0x70,
+	0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x61, 0x64, 0x42, 0x79, 0x49, 0x64, 0x12, 0x1b, 0x2e, 0x6d,
+	0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x61,
+	0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x1b, 0x2e, 0x6d, 0x65, 0x73, 0x73,
+	0x61, 0x67, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e,
+	0x63, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x4e, 0x0a, 0x0f, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72,
+	0x61, 0x77, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1e, 0x2e, 0x6d, 0x65, 0x73, 0x73,
+	0x61, 0x67, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x57, 0x69,
+	0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x52, 0x65, 0x71, 0x1a, 0x1b, 0x2e, 0x6d, 0x65, 0x73, 0x73,
+	0x61, 0x67, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e,
+	0x63, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x4a, 0x0a, 0x0f, 0x41, 0x70, 0x70, 0x72, 0x61, 0x69,
+	0x73, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x2e, 0x6d, 0x65, 0x73, 0x73,
+	0x61, 0x67, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x41, 0x70, 0x70, 0x72, 0x61, 0x69,
+	0x73, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x1b, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x63,
+	0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x52, 0x65,
+	0x73, 0x70, 0x12, 0x4b, 0x0a, 0x10, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69,
+	0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1e, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
+	0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74,
+	0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x17, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
+	0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12,
+	0x44, 0x0a, 0x09, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x43, 0x68, 0x61, 0x74, 0x12, 0x1d, 0x2e, 0x6d,
+	0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x65, 0x73,
+	0x73, 0x61, 0x67, 0x65, 0x53, 0x61, 0x76, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x18, 0x2e, 0x6d, 0x65,
+	0x73, 0x73, 0x61, 0x67, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x6d, 0x6d,
+	0x6f, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x58, 0x0a, 0x0f, 0x4f, 0x6e, 0x65, 0x55, 0x73, 0x65, 0x72,
+	0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61,
+	0x67, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x4f, 0x6e, 0x65, 0x55, 0x73, 0x65, 0x72,
+	0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x22, 0x2e, 0x6d, 0x65,
+	0x73, 0x73, 0x61, 0x67, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x4f, 0x6e, 0x65, 0x55,
+	0x73, 0x65, 0x72, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12,
+	0x59, 0x0a, 0x13, 0x4f, 0x6e, 0x65, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72,
+	0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
+	0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x4f, 0x6e, 0x65, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6f,
+	0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x1b, 0x2e,
+	0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x43, 0x75,
+	0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x52, 0x65, 0x73, 0x70, 0x42, 0x11, 0x5a, 0x0f, 0x2e, 0x2f,
+	0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x62, 0x06, 0x70,
+	0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var (
@@ -2326,30 +2413,31 @@ func file_messagecenter_proto_rawDescGZIP() []byte {
 	return file_messagecenter_proto_rawDescData
 }
 
-var file_messagecenter_proto_msgTypes = make([]protoimpl.MessageInfo, 22)
+var file_messagecenter_proto_msgTypes = make([]protoimpl.MessageInfo, 23)
 var file_messagecenter_proto_goTypes = []interface{}{
-	(*CountReq)(nil),            // 0: messagecenter.CountReq
-	(*CountResp)(nil),           // 1: messagecenter.CountResp
-	(*UserReq)(nil),             // 2: messagecenter.UserReq
-	(*UserResp)(nil),            // 3: messagecenter.UserResp
-	(*UserEntity)(nil),          // 4: messagecenter.UserEntity
-	(*MessageReq)(nil),          // 5: messagecenter.MessageReq
-	(*MessageResp)(nil),         // 6: messagecenter.MessageResp
-	(*SaveMessageResp)(nil),     // 7: messagecenter.SaveMessageResp
-	(*MessageEntity)(nil),       // 8: messagecenter.MessageEntity
-	(*ChatSessionReq)(nil),      // 9: messagecenter.ChatSessionReq
-	(*CloseSessionReq)(nil),     // 10: messagecenter.CloseSessionReq
-	(*ChatSessionResp)(nil),     // 11: messagecenter.ChatSessionResp
-	(*SaveAutoReplyReq)(nil),    // 12: messagecenter.SaveAutoReplyReq
-	(*ReadStateReq)(nil),        // 13: messagecenter.ReadStateReq
-	(*ReadWithdrawReq)(nil),     // 14: messagecenter.ReadWithdrawReq
-	(*AppraiseReq)(nil),         // 15: messagecenter.AppraiseReq
-	(*CurrencyResp)(nil),        // 16: messagecenter.CurrencyResp
-	(*ConversationReq)(nil),     // 17: messagecenter.ConversationReq
-	(*MessageSaveReq)(nil),      // 18: messagecenter.MessageSaveReq
-	(*CommonReq)(nil),           // 19: messagecenter.CommonReq
-	(*OneUserPositionReq)(nil),  // 20: messagecenter.OneUserPositionReq
-	(*OneUserPositionResp)(nil), // 21: messagecenter.OneUserPositionResp
+	(*CountReq)(nil),               // 0: messagecenter.CountReq
+	(*CountResp)(nil),              // 1: messagecenter.CountResp
+	(*UserReq)(nil),                // 2: messagecenter.UserReq
+	(*UserResp)(nil),               // 3: messagecenter.UserResp
+	(*UserEntity)(nil),             // 4: messagecenter.UserEntity
+	(*MessageReq)(nil),             // 5: messagecenter.MessageReq
+	(*MessageResp)(nil),            // 6: messagecenter.MessageResp
+	(*SaveMessageResp)(nil),        // 7: messagecenter.SaveMessageResp
+	(*MessageEntity)(nil),          // 8: messagecenter.MessageEntity
+	(*ChatSessionReq)(nil),         // 9: messagecenter.ChatSessionReq
+	(*CloseSessionReq)(nil),        // 10: messagecenter.CloseSessionReq
+	(*ChatSessionResp)(nil),        // 11: messagecenter.ChatSessionResp
+	(*SaveAutoReplyReq)(nil),       // 12: messagecenter.SaveAutoReplyReq
+	(*ReadStateReq)(nil),           // 13: messagecenter.ReadStateReq
+	(*ReadWithdrawReq)(nil),        // 14: messagecenter.ReadWithdrawReq
+	(*AppraiseReq)(nil),            // 15: messagecenter.AppraiseReq
+	(*CurrencyResp)(nil),           // 16: messagecenter.CurrencyResp
+	(*ConversationReq)(nil),        // 17: messagecenter.ConversationReq
+	(*MessageSaveReq)(nil),         // 18: messagecenter.MessageSaveReq
+	(*CommonReq)(nil),              // 19: messagecenter.CommonReq
+	(*OneUserPositionReq)(nil),     // 20: messagecenter.OneUserPositionReq
+	(*OneUserPositionResp)(nil),    // 21: messagecenter.OneUserPositionResp
+	(*OneUserConversationReq)(nil), // 22: messagecenter.OneUserConversationReq
 }
 var file_messagecenter_proto_depIdxs = []int32{
 	8,  // 0: messagecenter.CountResp.lastMessage:type_name -> messagecenter.MessageEntity
@@ -2369,21 +2457,23 @@ var file_messagecenter_proto_depIdxs = []int32{
 	17, // 14: messagecenter.messageCenter.ConversationList:input_type -> messagecenter.ConversationReq
 	18, // 15: messagecenter.messageCenter.GroupChat:input_type -> messagecenter.MessageSaveReq
 	20, // 16: messagecenter.messageCenter.OneUserPosition:input_type -> messagecenter.OneUserPositionReq
-	1,  // 17: messagecenter.messageCenter.Count:output_type -> messagecenter.CountResp
-	3,  // 18: messagecenter.messageCenter.UserList:output_type -> messagecenter.UserResp
-	6,  // 19: messagecenter.messageCenter.FindMessage:output_type -> messagecenter.MessageResp
-	7,  // 20: messagecenter.messageCenter.SaveMessage:output_type -> messagecenter.SaveMessageResp
-	11, // 21: messagecenter.messageCenter.CreateChatSession:output_type -> messagecenter.ChatSessionResp
-	11, // 22: messagecenter.messageCenter.CloseChatSession:output_type -> messagecenter.ChatSessionResp
-	6,  // 23: messagecenter.messageCenter.SaveAutoReplyMsg:output_type -> messagecenter.MessageResp
-	16, // 24: messagecenter.messageCenter.UpdateReadById:output_type -> messagecenter.CurrencyResp
-	16, // 25: messagecenter.messageCenter.WithdrawMessage:output_type -> messagecenter.CurrencyResp
-	16, // 26: messagecenter.messageCenter.AppraiseMessage:output_type -> messagecenter.CurrencyResp
-	3,  // 27: messagecenter.messageCenter.ConversationList:output_type -> messagecenter.UserResp
-	19, // 28: messagecenter.messageCenter.GroupChat:output_type -> messagecenter.CommonReq
-	21, // 29: messagecenter.messageCenter.OneUserPosition:output_type -> messagecenter.OneUserPositionResp
-	17, // [17:30] is the sub-list for method output_type
-	4,  // [4:17] is the sub-list for method input_type
+	22, // 17: messagecenter.messageCenter.OneUserConversation:input_type -> messagecenter.OneUserConversationReq
+	1,  // 18: messagecenter.messageCenter.Count:output_type -> messagecenter.CountResp
+	3,  // 19: messagecenter.messageCenter.UserList:output_type -> messagecenter.UserResp
+	6,  // 20: messagecenter.messageCenter.FindMessage:output_type -> messagecenter.MessageResp
+	7,  // 21: messagecenter.messageCenter.SaveMessage:output_type -> messagecenter.SaveMessageResp
+	11, // 22: messagecenter.messageCenter.CreateChatSession:output_type -> messagecenter.ChatSessionResp
+	11, // 23: messagecenter.messageCenter.CloseChatSession:output_type -> messagecenter.ChatSessionResp
+	6,  // 24: messagecenter.messageCenter.SaveAutoReplyMsg:output_type -> messagecenter.MessageResp
+	16, // 25: messagecenter.messageCenter.UpdateReadById:output_type -> messagecenter.CurrencyResp
+	16, // 26: messagecenter.messageCenter.WithdrawMessage:output_type -> messagecenter.CurrencyResp
+	16, // 27: messagecenter.messageCenter.AppraiseMessage:output_type -> messagecenter.CurrencyResp
+	3,  // 28: messagecenter.messageCenter.ConversationList:output_type -> messagecenter.UserResp
+	19, // 29: messagecenter.messageCenter.GroupChat:output_type -> messagecenter.CommonReq
+	21, // 30: messagecenter.messageCenter.OneUserPosition:output_type -> messagecenter.OneUserPositionResp
+	16, // 31: messagecenter.messageCenter.OneUserConversation:output_type -> messagecenter.CurrencyResp
+	18, // [18:32] is the sub-list for method output_type
+	4,  // [4:18] is the sub-list for method input_type
 	4,  // [4:4] is the sub-list for extension type_name
 	4,  // [4:4] is the sub-list for extension extendee
 	0,  // [0:4] is the sub-list for field type_name
@@ -2659,6 +2749,18 @@ func file_messagecenter_proto_init() {
 				return nil
 			}
 		}
+		file_messagecenter_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*OneUserConversationReq); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
 	}
 	type x struct{}
 	out := protoimpl.TypeBuilder{
@@ -2666,7 +2768,7 @@ func file_messagecenter_proto_init() {
 			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
 			RawDescriptor: file_messagecenter_proto_rawDesc,
 			NumEnums:      0,
-			NumMessages:   22,
+			NumMessages:   23,
 			NumExtensions: 0,
 			NumServices:   1,
 		},

+ 38 - 0
rpc/messagecenter/messagecenter/messagecenter_grpc.pb.go

@@ -48,6 +48,8 @@ type MessageCenterClient interface {
 	GroupChat(ctx context.Context, in *MessageSaveReq, opts ...grpc.CallOption) (*CommonReq, error)
 	// 1v1会话职位
 	OneUserPosition(ctx context.Context, in *OneUserPositionReq, opts ...grpc.CallOption) (*OneUserPositionResp, error)
+	// 1v1首次创建会话汇总表信息
+	OneUserConversation(ctx context.Context, in *OneUserConversationReq, opts ...grpc.CallOption) (*CurrencyResp, error)
 }
 
 type messageCenterClient struct {
@@ -175,6 +177,15 @@ func (c *messageCenterClient) OneUserPosition(ctx context.Context, in *OneUserPo
 	return out, nil
 }
 
+func (c *messageCenterClient) OneUserConversation(ctx context.Context, in *OneUserConversationReq, opts ...grpc.CallOption) (*CurrencyResp, error) {
+	out := new(CurrencyResp)
+	err := c.cc.Invoke(ctx, "/messagecenter.messageCenter/OneUserConversation", 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
@@ -205,6 +216,8 @@ type MessageCenterServer interface {
 	GroupChat(context.Context, *MessageSaveReq) (*CommonReq, error)
 	// 1v1会话职位
 	OneUserPosition(context.Context, *OneUserPositionReq) (*OneUserPositionResp, error)
+	// 1v1首次创建会话汇总表信息
+	OneUserConversation(context.Context, *OneUserConversationReq) (*CurrencyResp, error)
 	mustEmbedUnimplementedMessageCenterServer()
 }
 
@@ -251,6 +264,9 @@ func (UnimplementedMessageCenterServer) GroupChat(context.Context, *MessageSaveR
 func (UnimplementedMessageCenterServer) OneUserPosition(context.Context, *OneUserPositionReq) (*OneUserPositionResp, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method OneUserPosition not implemented")
 }
+func (UnimplementedMessageCenterServer) OneUserConversation(context.Context, *OneUserConversationReq) (*CurrencyResp, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method OneUserConversation not implemented")
+}
 func (UnimplementedMessageCenterServer) mustEmbedUnimplementedMessageCenterServer() {}
 
 // UnsafeMessageCenterServer may be embedded to opt out of forward compatibility for this service.
@@ -498,6 +514,24 @@ func _MessageCenter_OneUserPosition_Handler(srv interface{}, ctx context.Context
 	return interceptor(ctx, in, info, handler)
 }
 
+func _MessageCenter_OneUserConversation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(OneUserConversationReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(MessageCenterServer).OneUserConversation(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/messagecenter.messageCenter/OneUserConversation",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(MessageCenterServer).OneUserConversation(ctx, req.(*OneUserConversationReq))
+	}
+	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)
@@ -557,6 +591,10 @@ var MessageCenter_ServiceDesc = grpc.ServiceDesc{
 			MethodName: "OneUserPosition",
 			Handler:    _MessageCenter_OneUserPosition_Handler,
 		},
+		{
+			MethodName: "OneUserConversation",
+			Handler:    _MessageCenter_OneUserConversation_Handler,
+		},
 	},
 	Streams:  []grpc.StreamDesc{},
 	Metadata: "messagecenter.proto",

+ 3 - 3
service/chat_group.go

@@ -15,9 +15,9 @@ func EntPerson(entId int64, isAll bool) (map[string]string, map[string]string, m
 	nameData := map[string]string{}
 	positionData := map[int]string{}
 	//在职人员查询
-	personList := IC.MainMysql.Find(util.ENTNICHE_USER, map[string]interface{}{
-		"ent_Id": entId,
-	}, "phone,name", "", -1, -1)
+	personList := IC.MainMysql.SelectBySql(fmt.Sprintf(`SELECT a.phone,IF(a.name = "我" AND b.role_id = 1 ,"%s",a.name)  AS name,b.role_id FROM %s a
+					LEFT JOIN entniche_user_role b on a.id = b.user_id 
+					WHERE a.ent_id = %d`, util.UserRoleOne, util.ENTNICHE_USER, entId))
 	if personList != nil && len(*personList) > 0 {
 		for _, v := range *personList {
 			phoneData[common.InterfaceToStr(v["phone"])] = common.InterfaceToStr(v["name"])

+ 76 - 21
service/message_mail_box.go

@@ -188,11 +188,11 @@ func (b MessaggeService) UserList(in *messagecenter.UserReq) (data *[]map[string
 		   				b.nickname,
 		   				0 as unread,
 		   				b.headimg,
-						"" as phone,
+						b.phone,
 						0 as userType
 	   				FROM
 		   				socialize_summary a
-		   				INNER JOIN base_user b ON  (a.user_id = b.id AND a.ent_id = %d AND a.customer_service_access = 0)) 
+		   				INNER JOIN base_user b ON  (a.user_id = b.id AND a.ent_id = %d AND a.customer_service_access = 0) 
 		   				%s %s %s)`, in.EntId, timeSql, phoneSql, filtrationSql)
 
 		serviceSql := fmt.Sprintf(`(SELECT
@@ -202,7 +202,7 @@ func (b MessaggeService) UserList(in *messagecenter.UserReq) (data *[]map[string
 		   				b.nickname,
 		   				a.unread,
 		   				b.headimg,
-						"" as phone,
+						b.phone,
 						0 as userType
 	   				FROM
 		   				socialize_customer_service_user a
@@ -311,7 +311,8 @@ func (b MessaggeService) ConversationList(in *messagecenter.ConversationReq) (da
 		   				a.timestamp,
 		   				b.nickname,
 		   				0 as unread,
-		   				b.headimg
+		   				b.headimg,
+						b.phone
 	   				FROM
 		   				socialize_summary a
 		   				INNER JOIN base_user b ON  (a.user_id = b.id AND a.ent_id = %d AND a.customer_service_access = 0 
@@ -323,16 +324,44 @@ func (b MessaggeService) ConversationList(in *messagecenter.ConversationReq) (da
 		   				c.timestamp,
 		   				b.nickname,
 		   				a.unread,
-		   				b.headimg
+		   				b.headimg,
+						b.phone
 	   				FROM
 		   				socialize_customer_service_user a
 		   				INNER JOIN base_user b ON  ( a.customer_service_id = %d AND a.user_id = b.id %s)
 						INNER JOIN socialize_summary c ON ( a.ent_id = c.ent_id AND a.user_id = c.user_id))`, in.EntUserId, filtrationSql)
-		sqlStr = aiSql + " UNION ALL " + serviceSql
+		restrictionSql := aiSql + " UNION ALL " + serviceSql
+
+		sqlStr = fmt.Sprintf(`SELECT 
+    				(
+						CASE
+							WHEN SUBSTR( a.nickname, 1, 3 ) = 'JY_' THEN
+								CONCAT( SUBSTR( a.phone, 1, 3 ), '****', SUBSTR( a.phone, 8, 11 ) ) 
+							WHEN a.nickname = '' 
+							OR a.nickname IS NULL THEN
+								CONCAT( SUBSTR( a.phone, 1, 3 ), '****', SUBSTR( a.phone, 8, 11 ) ) ELSE a.nickname 
+						END 
+					) AS name,
+    				c.content,
+    				c.title,
+    				c.type,
+    				c.link,
+    				c.create_time,
+    				a.message_id,
+    				a.timestamp,
+    				a.unread as number,
+    				a.user_id as id,
+    				a.headimg,
+    				a.phone
+   				FROM
+	   				(%s) a
+				LEFT JOIN socialize_message c ON ( a.message_id = c.id )
+			ORDER BY
+			a.timestamp DESC`, restrictionSql)
 	}
 
 	if sqlStr != "" {
-		log.Println("查询列表sql:", sqlStr)
+		log.Println("ConversationList查询列表sql:", sqlStr)
 		data = IC.BaseMysql.SelectBySql(sqlStr)
 		log.Println("查询耗时2:", time.Since(tm), count)
 	}
@@ -564,8 +593,13 @@ func UserSynchronousList(customerServiceId, userId, entId, messageId int64, crea
 	nowForm := time.Now().Local()
 	create_time := nowForm.Format(util.Date_Full_Layout)
 	//查看汇总表
-	log.Println(IC.BaseMysql.Count(util.SOCIALIZE_SUMMARY, map[string]interface{}{"user_id": userId, "ent_id": entId}))
-	if IC.BaseMysql.Count(util.SOCIALIZE_SUMMARY, map[string]interface{}{"user_id": userId, "ent_id": entId}) > 0 {
+	data := IC.BaseMysql.FindOne(util.SOCIALIZE_SUMMARY, map[string]interface{}{"user_id": userId, "ent_id": entId}, "", "")
+	if data != nil && len(*data) > 0 {
+		if (*data)["customer_service_access"] == 0 && customerServiceId > 0 {
+			customerServiceId = 1
+		} else {
+			customerServiceId = quitl.Int64All((*data)["customer_service_access"])
+		}
 		//更新汇总表
 		ok := int64(0)
 		if sendUserType == 1 {
@@ -636,7 +670,7 @@ func (b MessaggeService) FindMessage(in *messagecenter.MessageReq) *[]map[string
 			"AND  a.type IN ( 2, 6 )  %s "+
 			"AND a.chat_group_id IS null "+
 			"AND a.send_user_type = a.receive_user_type "+
-			"ORDER BY a.create_time desc,a.id asc "+
+			"ORDER BY a.id desc "+
 			"limit 0 ,  %d ",
 			util.SOCIALIZE_MESSAGE_MAILBOX, util.SOCIALIZE_MESSAGE, util.BASE_USER, util.BASE_USER,
 			in.PositionId, in.PositionId, in.SendId, in.SendId, in.PositionId, lastStr, in.PageSize)
@@ -650,7 +684,7 @@ func (b MessaggeService) FindMessage(in *messagecenter.MessageReq) *[]map[string
 			"LEFT JOIN %s b ON a.messag_id = b.id "+
 			"WHERE a.own_type = 2  and a.iswithdraw = 0 AND a.own_id = %d "+
 			"AND a.chat_group_id = %d AND a.type IN ( 3, 6 )  %s "+
-			"ORDER BY a.create_time desc,a.id DESC "+
+			"ORDER BY a.id DESC "+
 			"LIMIT 0, %d",
 			util.SOCIALIZE_MESSAGE_MAILBOX, util.SOCIALIZE_MESSAGE, in.PositionId,
 			in.ChatGroupId, lastStr, in.PageSize)
@@ -668,7 +702,7 @@ func (b MessaggeService) FindMessage(in *messagecenter.MessageReq) *[]map[string
 				"AND c.ent_id =   %d "+
 				"AND c.user_id =   %d  %s "+
 				"AND a.send_user_type != a.receive_user_type "+
-				"ORDER BY a.create_time desc ,a.id asc "+
+				"ORDER BY a.id desc "+
 				"limit 0 ,  %d ",
 				util.SOCIALIZE_MESSAGE_MAILBOX, util.SOCIALIZE_MESSAGE, util.SOCIALIZE_CHAT_SESSION,
 				in.EntId, in.SendId, lastStr, in.PageSize)
@@ -686,7 +720,7 @@ func (b MessaggeService) FindMessage(in *messagecenter.MessageReq) *[]map[string
 				"AND c.user_id =  %d "+
 				"AND a.send_user_type != a.receive_user_type "+
 				"AND ( a.type = 4 OR a.type = 5 or a.type=6 or  a.type=7 or  a.type=8)  %s "+
-				"ORDER BY a.create_time  desc,a.id   asc "+
+				"ORDER BY a.id  desc "+
 				"limit 0 ,   %d ",
 				util.SOCIALIZE_MESSAGE_MAILBOX, util.SOCIALIZE_MESSAGE, util.SOCIALIZE_CHAT_SESSION, in.SendId, in.NewUserId, util.SOCIALIZE_TENANT_ROBOT, util.SOCIALIZE_APPRAISE,
 				in.NewUserId, in.SendId, in.NewUserId, lastStr, in.PageSize)
@@ -765,14 +799,14 @@ func (b MessaggeService) FindMessage(in *messagecenter.MessageReq) *[]map[string
 						"AND a.isread = 0    "+
 						"AND a.own_id IN (SELECT id FROM %s WHERE user_id = %d)",
 						util.SOCIALIZE_MESSAGE_MAILBOX, util.BASE_POSITION, in.NewUserId)
-					unreadSql = fmt.Sprintf("UPDATE %s SET unread = 0 WHERE user_id = %d AND customer_service_id = %d", util.Socialize_customer_service_user, in.NewUserId, in.EntUserId)
+					unreadSql = fmt.Sprintf("UPDATE %s SET unread = 0 WHERE user_id = %d AND customer_service_id = %d", util.Socialize_customer_service_user, in.SendId, in.EntUserId)
 				} else { //2用户
 					sqlStr = fmt.Sprintf("UPDATE %s a  SET a.isread = 1,    a.read_time = now( )  "+
 						"WHERE    a.own_type = 2 and a.iswithdraw = 0 "+
 						"AND a.type IN ( 4,5,6,7 )  "+
 						"AND a.isread = 0    "+
 						"AND a.own_id  in (%s) ", util.SOCIALIZE_MESSAGE_MAILBOX, positionStr)
-					unreadSql = fmt.Sprintf("UPDATE %s SET unread = 0 WHERE user_id = %d AND ent_id = %d", util.SOCIALIZE_SUMMARY, in.NewUserId, in.EntId)
+					unreadSql = fmt.Sprintf("UPDATE %s SET unread = 0 WHERE user_id = %d AND ent_id = %d", util.SOCIALIZE_SUMMARY, in.NewUserId, in.SendId)
 				}
 				IC.BaseMysql.UpdateOrDeleteBySql(sqlStr)
 				IC.BaseMysql.UpdateOrDeleteBySql(unreadSql)
@@ -1032,13 +1066,13 @@ func (this *MessaggeService) Chat(in *messagecenter.MessageEntity) (fool bool, e
 			for _, v := range in.GroupIds {
 				args := []interface{}{}
 				groupUser := GetUserByGroupId(tx, v, in.SendId)
+				//发送人自己
+				if !isWithdrawByOthers {
+					args = append(args, in.Appid, messageId, in.ItemType, in.SendId, 2, in.SendId, 2, 2, in.SendId, nowTime, v, 1)
+					//最后一次聊天
+					SocializeSummaryAddOrUpdate(tx, v, in.SendId, 0, messageId, isCustomerServiceAccess, nowTime)
+				}
 				for _, vv := range groupUser {
-					//发送人自己
-					if !isWithdrawByOthers {
-						args = append(args, in.Appid, messageId, in.ItemType, in.SendId, 2, vv, 2, 2, in.SendId, nowTime, v, 1)
-						//最后一次聊天
-						SocializeSummaryAddOrUpdate(tx, v, in.SendId, 0, messageId, isCustomerServiceAccess, nowTime)
-					}
 					if !isWithdrawByMyself {
 						log.Println("获取到群组下员工:", vv)
 						//接收人其他用户
@@ -1251,3 +1285,24 @@ func GetUserAllPosition(baseUserId int64) (positionStr string) {
 	}
 	return positionStr
 }
+
+// 1v1首次建立会话 创建汇总表
+func OneCreatingSession(in *messagecenter.OneUserConversationReq) string {
+	if in.MyPositionId < 0 || in.YouPositionId < 0 {
+		return "参数异常"
+	}
+	if IC.BaseMysql.Count(util.SOCIALIZE_SUMMARY, map[string]interface{}{"my_position_id": in.MyPositionId, "your_position_id": in.YouPositionId}) > 0 {
+		return ""
+	}
+	if IC.BaseMysql.Insert(util.SOCIALIZE_SUMMARY, map[string]interface{}{
+		"my_position_id":          in.MyPositionId,
+		"your_position_id":        in.YouPositionId,
+		"message_id":              0,
+		"timestamp":               time.Now().Format(date.Date_Full_Layout),
+		"unread":                  0,
+		"customer_service_access": 0,
+	}) > 0 {
+		return ""
+	}
+	return "创建汇总表数据失败"
+}