Ver Fonte

Merge remote-tracking branch 'origin/feature/v1.2.6' into dev/v1.2.6_dx

# Conflicts:
#	entity/util.go
#	rpc/messagecenter/messagecenter/messagecenter.pb.go
duxin há 2 anos atrás
pai
commit
ae75cc1299

+ 2 - 0
README.md

@@ -16,3 +16,5 @@ goctl 1.1.6
 ### 其他
 - 代理可使用 `GOPROXY=https://goproxy.io`
 - 目前使用的go 版本 1.16   (由于go-zero 对go版本有要求 ,go 1.15.1以下的版本,启动会报错)
+
+#

+ 3 - 0
api/messagecenter/internal/logic/chatgroupaddlogic.go

@@ -43,5 +43,8 @@ func (l *ChatGroupAddLogic) ChatGroupAdd(req *types.ChatGroupAddReq) (resp *type
 	return &types.CommonRes{
 		Error_msg:  result.ErrorMsg,
 		Error_code: int(result.ErrorCode),
+		Data: map[string]interface{}{
+			"status": result.Status,
+		},
 	}, nil
 }

+ 23 - 2
api/messagecenter/internal/logic/chatgroupjoinlogic.go

@@ -1,6 +1,9 @@
 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"
@@ -25,6 +28,24 @@ func NewChatGroupJoinLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Cha
 
 func (l *ChatGroupJoinLogic) ChatGroupJoin(req *types.ChatGroupJoinReq) (resp *types.CommonRes, err error) {
 	// todo: add your logic here and delete this line
-
-	return
+	userIdArr := []int64{}
+	for _, v := range req.UserIdArr {
+		userIdArr = append(userIdArr, quitl.Int64All(encrypt.SE.Decode4Hex(v)))
+	}
+	chatGroupId := quitl.Int64All(encrypt.SE.Decode4Hex(req.ChatGroupId))
+	result, err := l.svcCtx.Message.ChatGroupJoin(l.ctx, &messagecenter.ChatGroupJoinReq{
+		PositionId:  req.PositionId,
+		ChatGroupId: chatGroupId,
+		UserIdArr:   userIdArr,
+	})
+	if err != nil {
+		return nil, err
+	}
+	return &types.CommonRes{
+		Error_msg:  result.ErrorMsg,
+		Error_code: int(result.ErrorCode),
+		Data: map[string]interface{}{
+			"status": result.Status,
+		},
+	}, nil
 }

+ 16 - 2
api/messagecenter/internal/logic/chatgrouplistlogic.go

@@ -1,6 +1,7 @@
 package logic
 
 import (
+	"bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/messagecenter"
 	"context"
 
 	"bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/api/messagecenter/internal/svc"
@@ -25,6 +26,19 @@ func NewChatGroupListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Cha
 
 func (l *ChatGroupListLogic) ChatGroupList(req *types.ChatGroupListReq) (resp *types.CommonRes, err error) {
 	// todo: add your logic here and delete this line
-
-	return
+	result, err := l.svcCtx.Message.ChatGroupList(l.ctx, &messagecenter.ChatGroupListReq{
+		GroupName:  req.GroupName,
+		UserName:   req.UserName,
+		PositionId: req.PositionId,
+		AppId:      req.Appid,
+		EntId:      req.EntId,
+	})
+	if err != nil {
+		return nil, err
+	}
+	return &types.CommonRes{
+		Error_msg:  result.ErrorMsg,
+		Error_code: int(result.ErrorCode),
+		Data:       result.Data,
+	}, nil
 }

+ 17 - 2
api/messagecenter/internal/logic/chatgrouppersonlogic.go

@@ -1,6 +1,9 @@
 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"
@@ -25,6 +28,18 @@ func NewChatGroupPersonLogic(ctx context.Context, svcCtx *svc.ServiceContext) *C
 
 func (l *ChatGroupPersonLogic) ChatGroupPerson(req *types.ChatGroupPersonReq) (resp *types.CommonRes, err error) {
 	// todo: add your logic here and delete this line
-
-	return
+	chatGroupId := quitl.Int64All(encrypt.SE.Decode4Hex(req.ChatGroupId))
+	result, err := l.svcCtx.Message.ChatGroupPerson(l.ctx, &messagecenter.ChatGroupPersonReq{
+		ChatGroupId: chatGroupId,
+		AppId:       req.Appid,
+		EntId:       req.EntId,
+	})
+	if err != nil {
+		return nil, err
+	}
+	return &types.CommonRes{
+		Error_msg:  result.ErrorMsg,
+		Error_code: int(result.ErrorCode),
+		Data:       result.Data,
+	}, nil
 }

+ 10 - 9
api/messagecenter/internal/logic/findmessagelogic.go

@@ -28,15 +28,16 @@ func NewFindMessageLogic(ctx context.Context, svcCtx *svc.ServiceContext) *FindM
 func (l *FindMessageLogic) FindMessage(req *types.MessageReq) (*types.CommonRes, error) {
 	// todo: add your logic here and delete this line
 	resp, err := l.svcCtx.Message.FindMessage(l.ctx, &messagecenter.MessageReq{
-		UserType:  req.UserType,
-		MsgType:   req.MsgType,
-		SendId:    quitl.Int64All(encrypt.SE.Decode4Hex(req.SendId)),
-		LastId:    quitl.Int64All(encrypt.SE.Decode4Hex(req.LastId)),
-		EntId:     req.EntId,
-		PageSize:  req.PageSize,
-		EntUserId: req.EntUserId,
-		NewUserId: req.NewUserId,
-		Sort:      req.Sort,
+		UserType:    req.UserType,
+		MsgType:     req.MsgType,
+		SendId:      quitl.Int64All(encrypt.SE.Decode4Hex(req.SendId)),
+		LastId:      quitl.Int64All(encrypt.SE.Decode4Hex(req.LastId)),
+		EntId:       req.EntId,
+		PageSize:    req.PageSize,
+		EntUserId:   req.EntUserId,
+		NewUserId:   req.NewUserId,
+		Sort:        req.Sort,
+		ChatGroupId: req.ChatGroupId,
 	})
 	if err != nil {
 		return nil, err

+ 26 - 2
api/messagecenter/internal/logic/groupnameupdatelogic.go

@@ -1,6 +1,9 @@
 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"
@@ -25,6 +28,27 @@ func NewGroupNameUpdateLogic(ctx context.Context, svcCtx *svc.ServiceContext) *G
 
 func (l *GroupNameUpdateLogic) GroupNameUpdate(req *types.GroupNameUpdateReq) (resp *types.CommonRes, err error) {
 	// todo: add your logic here and delete this line
-
-	return
+	chatGroupId := quitl.Int64All(encrypt.SE.Decode4Hex(req.ChatGroupId))
+	if len(req.GroupName)>15{
+		return &types.CommonRes{
+			Error_msg:  "超过15个字,请调整后保存",
+			Error_code: ,
+		}, nil
+	}
+	result, err := l.svcCtx.Message.GroupNameUpdate(l.ctx, &messagecenter.GroupNameUpdateReq{
+		PositionId:  req.PositionId,
+		AppId:       req.Appid,
+		GroupName:   req.GroupName,
+		ChatGroupId: chatGroupId,
+	})
+	if err != nil {
+		return nil, err
+	}
+	return &types.CommonRes{
+		Error_msg:  result.ErrorMsg,
+		Error_code: int(result.ErrorCode),
+		Data: map[string]interface{}{
+			"status": result.Status,
+		},
+	}, nil
 }

+ 19 - 2
api/messagecenter/internal/logic/groupnoticeaddlogic.go

@@ -1,6 +1,9 @@
 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"
@@ -25,6 +28,20 @@ func NewGroupNoticeAddLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Gr
 
 func (l *GroupNoticeAddLogic) GroupNoticeAdd(req *types.GroupNoticeAddReq) (resp *types.CommonRes, err error) {
 	// todo: add your logic here and delete this line
-
-	return
+	chatGroupId := quitl.Int64All(encrypt.SE.Decode4Hex(req.ChatGroupId))
+	result, err := l.svcCtx.Message.GroupNoticeAdd(l.ctx, &messagecenter.GroupNoticeAddReq{
+		AppId:       req.Appid,
+		Content:     req.Content,
+		ChatGroupId: chatGroupId,
+	})
+	if err != nil {
+		return nil, err
+	}
+	return &types.CommonRes{
+		Error_msg:  result.ErrorMsg,
+		Error_code: int(result.ErrorCode),
+		Data: map[string]interface{}{
+			"status": result.Status,
+		},
+	}, nil
 }

+ 16 - 1
api/messagecenter/internal/logic/groupnoticegetlogic.go

@@ -1,6 +1,9 @@
 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"
@@ -25,6 +28,18 @@ func NewGroupNoticeGetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Gr
 
 func (l *GroupNoticeGetLogic) GroupNoticeGet(req *types.ChatGroupPersonReq) (resp *types.CommonRes, err error) {
 	// todo: add your logic here and delete this line
-
+	chatGroupId := quitl.Int64All(encrypt.SE.Decode4Hex(req.ChatGroupId))
+	result, err := l.svcCtx.Message.GroupNoticeGet(l.ctx, &messagecenter.ChatGroupPersonReq{
+		AppId:       req.Appid,
+		ChatGroupId: chatGroupId,
+	})
+	if err != nil {
+		return nil, err
+	}
+	return &types.CommonRes{
+		Error_msg:  result.ErrorMsg,
+		Error_code: int(result.ErrorCode),
+		Data:       result.Data,
+	}, nil
 	return
 }

+ 19 - 3
api/messagecenter/internal/logic/groupnoticeupdatelogic.go

@@ -1,6 +1,9 @@
 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"
@@ -23,8 +26,21 @@ func NewGroupNoticeUpdateLogic(ctx context.Context, svcCtx *svc.ServiceContext)
 	}
 }
 
-func (l *GroupNoticeUpdateLogic) GroupNoticeUpdate(req *types.GroupNameUpdateReq) (resp *types.CommonRes, err error) {
+func (l *GroupNoticeUpdateLogic) GroupNoticeUpdate(req *types.GroupNoticeUpdateReq) (resp *types.CommonRes, err error) {
 	// todo: add your logic here and delete this line
-
-	return
+	groupNoticeId := quitl.Int64All(encrypt.SE.Decode4Hex(req.GroupNoticeId))
+	result, err := l.svcCtx.Message.GroupNoticeUpdate(l.ctx, &messagecenter.GroupNoticeUpdateReq{
+		AppId:         req.Appid,
+		GroupNoticeId: groupNoticeId,
+	})
+	if err != nil {
+		return nil, err
+	}
+	return &types.CommonRes{
+		Error_msg:  result.ErrorMsg,
+		Error_code: int(result.ErrorCode),
+		Data: map[string]interface{}{
+			"status": result.Status,
+		},
+	}, nil
 }

+ 23 - 13
api/messagecenter/internal/types/types.go

@@ -45,15 +45,16 @@ type MessageEntity struct {
 }
 
 type MessageReq struct {
-	MsgType   int64  `json:"msgType"`
-	UserType  int64  `json:"userType"`
-	SendId    string `json:"sendId,optional"`
-	LastId    string `json:"lastId,optional"`
-	PageSize  int64  `json:"pageSize"`
-	NewUserId int64  `header:"newUserId"`
-	EntUserId int64  `header:"entUserId,optional"`
-	EntId     int64  `header:"entId,optional"`
-	Sort      string `json:"sort,optional"`
+	MsgType     int64  `json:"msgType"`
+	UserType    int64  `json:"userType"`
+	SendId      string `json:"sendId,optional"`
+	LastId      string `json:"lastId,optional"`
+	PageSize    int64  `json:"pageSize"`
+	NewUserId   int64  `header:"newUserId"`
+	EntUserId   int64  `header:"entUserId,optional"`
+	EntId       int64  `header:"entId,optional"`
+	Sort        string `json:"sort,optional"`
+	ChatGroupId int64  `json:"chatGroupId,optional"`
 }
 
 type CommonRes struct {
@@ -94,39 +95,47 @@ type ChatGroupListReq struct {
 	EntId      int64  `header:"entId,optional"`
 	UserName   string `json:"userName"`
 	GroupName  string `json:"groupName"`
-	PositionId string `header:"positionId,optional"`
+	PositionId int64  `header:"positionId,optional"`
+	Appid      string `header:"appId"`
 }
 
 type ChatGroupAddReq struct {
 	EntId      int64    `header:"entId,optional"`
 	PositionId int64    `header:"positionId,optional"`
 	UserIdArr  []string `json:"userIdArr"`
+	Appid      string   `header:"appId"`
 }
 
 type ChatGroupPersonReq struct {
 	ChatGroupId string `json:"chatGroupId"`
 	EntId       int64  `header:"entId,optional"`
+	Appid       string `header:"appId"`
 }
 
 type ChatGroupJoinReq struct {
-	ChatGroupId string `json:"chatGroupId"`
-	PositionId  string `json:"positionId"`
+	ChatGroupId string   `json:"chatGroupId"`
+	PositionId  int64    `json:"positionId"`
+	Appid       string   `header:"appId"`
+	UserIdArr   []string `json:"userIdArr"`
 }
 
 type GroupNameUpdateReq struct {
 	ChatGroupId string `json:"chatGroupId"`
-	PositionId  string `header:"positionId,optional"`
+	PositionId  int64  `header:"positionId,optional"`
 	GroupName   string `json:"groupName"`
+	Appid       string `header:"appId"`
 }
 
 type GroupNoticeAddReq struct {
 	ChatGroupId string `json:"chatGroupId"`
 	Content     string `json:"content"`
+	Appid       string `header:"appId"`
 }
 
 type GroupNoticeUpdateReq struct {
 	Content       string `json:"content"`
 	GroupNoticeId string `json:"groupNoticeId"`
+	Appid         string `header:"appId"`
 }
 
 type ReadWithdrawReq struct {
@@ -146,4 +155,5 @@ type AppraiseMessageReq struct {
 	NewUserId int64  `header:"newUserId"`
 	MessageId string `json:"messageId"`
 	Appraise  int64  `json:"appraise,options=-1|1"`
+	Appid         string `header:"appId"`
 }

+ 22 - 13
api/messagecenter/messagecenter.api

@@ -40,15 +40,16 @@ type MessageEntity {
 	ReceiveId string `json:"receiveId,optional"`
 }
 type MessageReq {
-	MsgType   int64  `json:"msgType"`
-	UserType  int64  `json:"userType"`
-	SendId    string `json:"sendId,optional"`
-	LastId    string `json:"lastId,optional"`
-	PageSize  int64  `json:"pageSize"`
-	NewUserId int64  `header:"newUserId"`
-	EntUserId int64  `header:"entUserId,optional"`
-	EntId     int64  `header:"entId,optional"`
-	Sort      string `json:"sort,optional"`
+	MsgType     int64  `json:"msgType"`
+	UserType    int64  `json:"userType"`
+	SendId      string `json:"sendId,optional"`
+	LastId      string `json:"lastId,optional"`
+	PageSize    int64  `json:"pageSize"`
+	NewUserId   int64  `header:"newUserId"`
+	EntUserId   int64  `header:"entUserId,optional"`
+	EntId       int64  `header:"entId,optional"`
+	Sort        string `json:"sort,optional"`
+	ChatGroupId int64  `json:"chatGroupId,optional"`
 }
 
 type CommonRes {
@@ -84,33 +85,41 @@ type ChatGroupListReq {
 	EntId      int64  `header:"entId,optional"`
 	UserName   string `json:"userName"`
 	GroupName  string `json:"groupName"`
-	PositionId string `header:"positionId,optional"`
+	PositionId int64  `header:"positionId,optional"`
+	Appid      string `header:"appId"`
 }
 type ChatGroupAddReq {
 	EntId      int64    `header:"entId,optional"`
 	PositionId int64    `header:"positionId,optional"`
 	UserIdArr  []string `json:"userIdArr"`
+	Appid      string   `header:"appId"`
 }
 type ChatGroupPersonReq {
 	ChatGroupId string `json:"chatGroupId"`
 	EntId       int64  `header:"entId,optional"`
+	Appid       string `header:"appId"`
 }
 type ChatGroupJoinReq {
-	ChatGroupId string `json:"chatGroupId"`
-	PositionId  string `json:"positionId"`
+	ChatGroupId string   `json:"chatGroupId"`
+	PositionId  int64    `json:"positionId"`
+	Appid       string   `header:"appId"`
+	UserIdArr   []string `json:"userIdArr"`
 }
 type GroupNameUpdateReq {
 	ChatGroupId string `json:"chatGroupId"`
-	PositionId  string `header:"positionId,optional"`
+	PositionId  int64  `header:"positionId,optional"`
 	GroupName   string `json:"groupName"`
+	Appid       string `header:"appId"`
 }
 type GroupNoticeAddReq {
 	ChatGroupId string `json:"chatGroupId"`
 	Content     string `json:"content"`
+	Appid       string `header:"appId"`
 }
 type GroupNoticeUpdateReq {
 	Content       string `json:"content"`
 	GroupNoticeId string `json:"groupNoticeId"`
+	Appid         string `header:"appId"`
 }
 
 type ReadWithdrawReq {

+ 4 - 2
entity/util.go

@@ -21,12 +21,14 @@ const (
 	SOCIALIZE_CHAT_GROUP        = "socialize_chat_group"
 	SOCIALIZE_CHAT_GROUP_NOTICE = "socialize_chat_group_notice"
 	SOCIALIZE_CHAT_GROUP_PERSON = "socialize_chat_group_person"
+	BASE_POSITION               = "base_position"
 	User_message_list           = "user_message_list"
 	//mainMysql
 	ENTNICHE_USER = "entniche_user"
 	//mongo
-	ENTNICHE_DELETE                 = "entniche_delete"
-	SOCIALIZE_APPRAISE              = "socialize_message_appraise"
+	ENTNICHE_DELETE    = "entniche_delete"
+	SOCIALIZE_APPRAISE = "socialize_message_appraise"
+	SOCIALIZE_SUMMARY  = "socialize_summary"
 	Socialize_summary               = "socialize_summary"
 	Socialize_customer_service_user = "socialize_customer_service_user"
 )

+ 1 - 0
go.mod

@@ -7,6 +7,7 @@ require (
 	app.yhyue.com/moapp/jypkg v0.0.0-20230407092858-0d6d33fa63d6
 	bp.jydev.jianyu360.cn/BaseService/gateway v1.3.4
 	github.com/go-sql-driver/mysql v1.7.0
+	github.com/gogf/gf/v2 v2.0.6
 	github.com/microcosm-cc/bluemonday v1.0.23
 	github.com/zeromicro/go-zero v1.4.4
 	google.golang.org/grpc v1.53.0

+ 7 - 7
rpc/messagecenter/internal/logic/entpersonslistlogic.go → rpc/messagecenter/internal/logic/groupchatlogic.go

@@ -9,23 +9,23 @@ import (
 	"github.com/zeromicro/go-zero/core/logx"
 )
 
-type EntPersonsListLogic struct {
+type GroupChatLogic struct {
 	ctx    context.Context
 	svcCtx *svc.ServiceContext
 	logx.Logger
 }
 
-func NewEntPersonsListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *EntPersonsListLogic {
-	return &EntPersonsListLogic{
+func NewGroupChatLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GroupChatLogic {
+	return &GroupChatLogic{
 		ctx:    ctx,
 		svcCtx: svcCtx,
 		Logger: logx.WithContext(ctx),
 	}
 }
 
-// 通讯录 -企业人员列表
-func (l *EntPersonsListLogic) EntPersonsList(in *messagecenter.EntPersonsListReq) (*messagecenter.EntPersonListResp, error) {
+//  群聊
+func (l *GroupChatLogic) GroupChat(in *messagecenter.MessageSaveReq) (*messagecenter.CommonReq, error) {
 	// todo: add your logic here and delete this line
-	ChatGroup.EntPersonsList(in)
-	return &messagecenter.EntPersonListResp{}, nil
+
+	return &messagecenter.CommonReq{}, nil
 }

+ 14 - 14
rpc/messagecenter/internal/server/messagecenterserver.go

@@ -22,37 +22,37 @@ func NewMessageCenterServer(svcCtx *svc.ServiceContext) *MessageCenterServer {
 	}
 }
 
-// 查询数量
+//  查询数量
 func (s *MessageCenterServer) Count(ctx context.Context, in *messagecenter.CountReq) (*messagecenter.CountResp, error) {
 	l := logic.NewCountLogic(ctx, s.svcCtx)
 	return l.Count(in)
 }
 
-// 用户列表查询
+//  用户列表查询
 func (s *MessageCenterServer) UserList(ctx context.Context, in *messagecenter.UserReq) (*messagecenter.UserResp, error) {
 	l := logic.NewUserListLogic(ctx, s.svcCtx)
 	return l.UserList(in)
 }
 
-// 聊天内容查询
+//  聊天内容查询
 func (s *MessageCenterServer) FindMessage(ctx context.Context, in *messagecenter.MessageReq) (*messagecenter.MessageResp, error) {
 	l := logic.NewFindMessageLogic(ctx, s.svcCtx)
 	return l.FindMessage(in)
 }
 
-// 聊天保存
+//  聊天保存
 func (s *MessageCenterServer) SaveMessage(ctx context.Context, in *messagecenter.MessageEntity) (*messagecenter.SaveMessageResp, error) {
 	l := logic.NewSaveMessageLogic(ctx, s.svcCtx)
 	return l.SaveMessage(in)
 }
 
-// 会话创建
+//  会话创建
 func (s *MessageCenterServer) CreateChatSession(ctx context.Context, in *messagecenter.ChatSessionReq) (*messagecenter.ChatSessionResp, error) {
 	l := logic.NewCreateChatSessionLogic(ctx, s.svcCtx)
 	return l.CreateChatSession(in)
 }
 
-// 会话关闭
+//  会话关闭
 func (s *MessageCenterServer) CloseChatSession(ctx context.Context, in *messagecenter.CloseSessionReq) (*messagecenter.ChatSessionResp, error) {
 	l := logic.NewCloseChatSessionLogic(ctx, s.svcCtx)
 	return l.CloseChatSession(in)
@@ -118,26 +118,26 @@ func (s *MessageCenterServer) GroupNoticeGet(ctx context.Context, in *messagecen
 	return l.GroupNoticeGet(in)
 }
 
-// 通讯录 -企业人员列表
-func (s *MessageCenterServer) EntPersonsList(ctx context.Context, in *messagecenter.EntPersonsListReq) (*messagecenter.EntPersonListResp, error) {
-	l := logic.NewEntPersonsListLogic(ctx, s.svcCtx)
-	return l.EntPersonsList(in)
-}
-
 // 用户撤回消息
 func (s *MessageCenterServer) WithdrawMessage(ctx context.Context, in *messagecenter.ReadWithdrawReq) (*messagecenter.CurrencyResp, error) {
 	l := logic.NewWithdrawMessageLogic(ctx, s.svcCtx)
 	return l.WithdrawMessage(in)
 }
 
-// 用户评价回复
+//  用户评价回复
 func (s *MessageCenterServer) AppraiseMessage(ctx context.Context, in *messagecenter.AppraiseReq) (*messagecenter.CurrencyResp, error) {
 	l := logic.NewAppraiseMessageLogic(ctx, s.svcCtx)
 	return l.AppraiseMessage(in)
 }
 
-// 客服列表查询
+//  客服列表查询
 func (s *MessageCenterServer) ConversationList(ctx context.Context, in *messagecenter.ConversationReq) (*messagecenter.UserResp, error) {
 	l := logic.NewConversationListLogic(ctx, s.svcCtx)
 	return l.ConversationList(in)
 }
+
+//  群聊
+func (s *MessageCenterServer) GroupChat(ctx context.Context, in *messagecenter.MessageSaveReq) (*messagecenter.CommonReq, error) {
+	l := logic.NewGroupChatLogic(ctx, s.svcCtx)
+	return l.GroupChat(in)
+}

+ 19 - 26
rpc/messagecenter/messagecenter.proto

@@ -60,6 +60,7 @@ message MessageReq {
   int64         entId = 8;
   int64         customerEntId = 9;
   string        sort = 10;
+  int64         chatGroupId = 11;
 }
 message MessageResp {
   int64         count = 1;
@@ -229,30 +230,6 @@ message  GroupNotice{
   string content = 1;
   string  groupNoticeId = 2;
 }
-//企业人员列表、拉人进群列表
-message EntPersonsListReq{
-  string name =1;
-  int64 entId = 2;
-  int64 GroupId = 3;
-}
-message PersonInfo{
-  int64 id = 1;
-  string personName = 2;
-  string phone = 3;
-  string email = 4;
-  int64 positionId = 5;
-}
-message departmentsInfo{
-  int64 id = 1;
-  string departmentName = 2;
-  repeated PersonInfo persons = 3;//部门下的人
-}
-message EntPersonListResp{
-  int64         error_code = 1; //响应代码
-  string        error_msg = 2; //响应消息
-  repeated departmentsInfo data = 3; //返回数据
-  string entName = 4;
-}
 
 message ConversationReq {
   int64     newUserId = 4;  //用户标识
@@ -261,6 +238,22 @@ message ConversationReq {
   int64     entUserId = 6;  //企业标识
   string    filtrationId = 10; //客服列表过滤会话中派对中用户
 }
+
+//聊天保存
+message MessageSaveReq {
+  string        title = 1; //标题
+  string        content = 2; //内容
+  int64         type = 3; //类型; 1:聊天 2:系统消息
+  string        appid = 4;
+  repeated int64        groupIds =5;//群聊id [群组id]
+  repeated int64        receiverIds =6;//群聊接收人id [接收人为职位id]
+  int64  sendId =7; //发送人[发送人职位id]
+  int64 item = 8; //1-活动优惠 2-服务通知 3-订阅消息 4-项目动态 5-企业动态 6-分析报告 7-系统通知 8-聊天消息
+  int64 messageType =9;//1:文本 2:链接 3:图片 4:附件
+  string link =10; //链接
+}
+
+
 service messageCenter {
   // 查询数量
   rpc Count(CountReq) returns(CountResp);
@@ -294,12 +287,12 @@ service messageCenter {
   rpc GroupNoticeUpdate(GroupNoticeUpdateReq)returns(CommonReq);
   //群任务详情
   rpc GroupNoticeGet(ChatGroupPersonReq)returns(GroupNoticeGetResp);
-  //通讯录 -企业人员列表
-  rpc EntPersonsList(EntPersonsListReq) returns(EntPersonListResp);
   //用户撤回消息
   rpc WithdrawMessage(ReadWithdrawReq)returns(CurrencyResp);
   // 用户评价回复
   rpc AppraiseMessage(AppraiseReq) returns(CurrencyResp);
   // 客服列表查询
   rpc ConversationList(ConversationReq) returns(UserResp);
+  // 群聊
+  rpc GroupChat(MessageSaveReq)returns(CommonReq);
 }

+ 16 - 16
rpc/messagecenter/messagecenter/messagecenter.go

@@ -44,14 +44,14 @@ type (
 		GroupNoticeUpdate(ctx context.Context, in *GroupNoticeUpdateReq, opts ...grpc.CallOption) (*CommonReq, error)
 		// 群任务详情
 		GroupNoticeGet(ctx context.Context, in *ChatGroupPersonReq, opts ...grpc.CallOption) (*GroupNoticeGetResp, error)
-		// 通讯录 -企业人员列表
-		EntPersonsList(ctx context.Context, in *EntPersonsListReq, opts ...grpc.CallOption) (*EntPersonListResp, error)
 		// 用户撤回消息
 		WithdrawMessage(ctx context.Context, in *ReadWithdrawReq, opts ...grpc.CallOption) (*CurrencyResp, error)
 		//  用户评价回复
 		AppraiseMessage(ctx context.Context, in *AppraiseReq, opts ...grpc.CallOption) (*CurrencyResp, error)
 		//  客服列表查询
 		ConversationList(ctx context.Context, in *ConversationReq, opts ...grpc.CallOption) (*UserResp, error)
+		//  群聊
+		GroupChat(ctx context.Context, in *MessageSaveReq, opts ...grpc.CallOption) (*CommonReq, error)
 	}
 
 	defaultMessageCenter struct {
@@ -65,37 +65,37 @@ 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) UserList(ctx context.Context, in *UserReq, opts ...grpc.CallOption) (*UserResp, error) {
 	client := NewMessageCenterClient(m.cli.Conn())
 	return client.UserList(ctx, in, opts...)
 }
 
-// 聊天内容查询
+//  聊天内容查询
 func (m *defaultMessageCenter) FindMessage(ctx context.Context, in *MessageReq, opts ...grpc.CallOption) (*MessageResp, error) {
 	client := NewMessageCenterClient(m.cli.Conn())
 	return client.FindMessage(ctx, in, opts...)
 }
 
-// 聊天保存
+//  聊天保存
 func (m *defaultMessageCenter) SaveMessage(ctx context.Context, in *MessageEntity, opts ...grpc.CallOption) (*SaveMessageResp, error) {
 	client := NewMessageCenterClient(m.cli.Conn())
 	return client.SaveMessage(ctx, in, opts...)
 }
 
-// 会话创建
+//  会话创建
 func (m *defaultMessageCenter) CreateChatSession(ctx context.Context, in *ChatSessionReq, opts ...grpc.CallOption) (*ChatSessionResp, error) {
 	client := NewMessageCenterClient(m.cli.Conn())
 	return client.CreateChatSession(ctx, in, opts...)
 }
 
-// 会话关闭
+//  会话关闭
 func (m *defaultMessageCenter) CloseChatSession(ctx context.Context, in *CloseSessionReq, opts ...grpc.CallOption) (*ChatSessionResp, error) {
 	client := NewMessageCenterClient(m.cli.Conn())
 	return client.CloseChatSession(ctx, in, opts...)
@@ -161,26 +161,26 @@ func (m *defaultMessageCenter) GroupNoticeGet(ctx context.Context, in *ChatGroup
 	return client.GroupNoticeGet(ctx, in, opts...)
 }
 
-// 通讯录 -企业人员列表
-func (m *defaultMessageCenter) EntPersonsList(ctx context.Context, in *EntPersonsListReq, opts ...grpc.CallOption) (*EntPersonListResp, error) {
-	client := NewMessageCenterClient(m.cli.Conn())
-	return client.EntPersonsList(ctx, in, opts...)
-}
-
 // 用户撤回消息
 func (m *defaultMessageCenter) WithdrawMessage(ctx context.Context, in *ReadWithdrawReq, opts ...grpc.CallOption) (*CurrencyResp, error) {
 	client := NewMessageCenterClient(m.cli.Conn())
 	return client.WithdrawMessage(ctx, in, opts...)
 }
 
-// 用户评价回复
+//  用户评价回复
 func (m *defaultMessageCenter) AppraiseMessage(ctx context.Context, in *AppraiseReq, opts ...grpc.CallOption) (*CurrencyResp, error) {
 	client := NewMessageCenterClient(m.cli.Conn())
 	return client.AppraiseMessage(ctx, in, opts...)
 }
 
-// 客服列表查询
+//  客服列表查询
 func (m *defaultMessageCenter) ConversationList(ctx context.Context, in *ConversationReq, opts ...grpc.CallOption) (*UserResp, error) {
 	client := NewMessageCenterClient(m.cli.Conn())
 	return client.ConversationList(ctx, in, opts...)
 }
+
+//  群聊
+func (m *defaultMessageCenter) GroupChat(ctx context.Context, in *MessageSaveReq, opts ...grpc.CallOption) (*CommonReq, error) {
+	client := NewMessageCenterClient(m.cli.Conn())
+	return client.GroupChat(ctx, in, opts...)
+}

Diff do ficheiro suprimidas por serem muito extensas
+ 476 - 699
rpc/messagecenter/messagecenter/messagecenter.pb.go


+ 60 - 60
rpc/messagecenter/messagecenter/messagecenter_grpc.pb.go

@@ -34,34 +34,34 @@ type MessageCenterClient interface {
 	CreateChatSession(ctx context.Context, in *ChatSessionReq, opts ...grpc.CallOption) (*ChatSessionResp, error)
 	// 会话关闭
 	CloseChatSession(ctx context.Context, in *CloseSessionReq, opts ...grpc.CallOption) (*ChatSessionResp, error)
-	// 创建会话并且保存信息
+	//创建会话并且保存信息
 	SaveAutoReplyMsg(ctx context.Context, in *SaveAutoReplyReq, opts ...grpc.CallOption) (*MessageResp, error)
-	// 根据消息修改已读状态
+	//根据消息修改已读状态
 	UpdateReadById(ctx context.Context, in *ReadStateReq, opts ...grpc.CallOption) (*CurrencyResp, error)
-	// 群组列表查询
+	//群组列表查询
 	ChatGroupList(ctx context.Context, in *ChatGroupListReq, opts ...grpc.CallOption) (*ChatGroupListResp, error)
-	// 群组新增
+	//群组新增
 	ChatGroupAdd(ctx context.Context, in *ChatGroupAddReq, opts ...grpc.CallOption) (*CommonReq, error)
-	// 群组成员查询
+	//群组成员查询
 	ChatGroupPerson(ctx context.Context, in *ChatGroupPersonReq, opts ...grpc.CallOption) (*ChatGroupPersonResp, error)
-	// 加入群组
+	//加入群组
 	ChatGroupJoin(ctx context.Context, in *ChatGroupJoinReq, opts ...grpc.CallOption) (*CommonReq, error)
-	// 群组名称修改
+	//群组名称修改
 	GroupNameUpdate(ctx context.Context, in *GroupNameUpdateReq, opts ...grpc.CallOption) (*CommonReq, error)
-	// 群任务新增
+	//群任务新增
 	GroupNoticeAdd(ctx context.Context, in *GroupNoticeAddReq, opts ...grpc.CallOption) (*CommonReq, error)
-	// 群任务编辑
+	//群任务编辑
 	GroupNoticeUpdate(ctx context.Context, in *GroupNoticeUpdateReq, opts ...grpc.CallOption) (*CommonReq, error)
-	// 群任务详情
+	//群任务详情
 	GroupNoticeGet(ctx context.Context, in *ChatGroupPersonReq, opts ...grpc.CallOption) (*GroupNoticeGetResp, error)
-	// 通讯录 -企业人员列表
-	EntPersonsList(ctx context.Context, in *EntPersonsListReq, opts ...grpc.CallOption) (*EntPersonListResp, error)
-	// 用户撤回消息
+	//用户撤回消息
 	WithdrawMessage(ctx context.Context, in *ReadWithdrawReq, opts ...grpc.CallOption) (*CurrencyResp, error)
 	// 用户评价回复
 	AppraiseMessage(ctx context.Context, in *AppraiseReq, opts ...grpc.CallOption) (*CurrencyResp, error)
 	// 客服列表查询
 	ConversationList(ctx context.Context, in *ConversationReq, opts ...grpc.CallOption) (*UserResp, error)
+	// 群聊
+	GroupChat(ctx context.Context, in *MessageSaveReq, opts ...grpc.CallOption) (*CommonReq, error)
 }
 
 type messageCenterClient struct {
@@ -216,15 +216,6 @@ func (c *messageCenterClient) GroupNoticeGet(ctx context.Context, in *ChatGroupP
 	return out, nil
 }
 
-func (c *messageCenterClient) EntPersonsList(ctx context.Context, in *EntPersonsListReq, opts ...grpc.CallOption) (*EntPersonListResp, error) {
-	out := new(EntPersonListResp)
-	err := c.cc.Invoke(ctx, "/messagecenter.messageCenter/EntPersonsList", in, out, opts...)
-	if err != nil {
-		return nil, err
-	}
-	return out, nil
-}
-
 func (c *messageCenterClient) WithdrawMessage(ctx context.Context, in *ReadWithdrawReq, opts ...grpc.CallOption) (*CurrencyResp, error) {
 	out := new(CurrencyResp)
 	err := c.cc.Invoke(ctx, "/messagecenter.messageCenter/WithdrawMessage", in, out, opts...)
@@ -252,6 +243,15 @@ func (c *messageCenterClient) ConversationList(ctx context.Context, in *Conversa
 	return out, nil
 }
 
+func (c *messageCenterClient) GroupChat(ctx context.Context, in *MessageSaveReq, opts ...grpc.CallOption) (*CommonReq, error) {
+	out := new(CommonReq)
+	err := c.cc.Invoke(ctx, "/messagecenter.messageCenter/GroupChat", 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
@@ -268,34 +268,34 @@ type MessageCenterServer interface {
 	CreateChatSession(context.Context, *ChatSessionReq) (*ChatSessionResp, error)
 	// 会话关闭
 	CloseChatSession(context.Context, *CloseSessionReq) (*ChatSessionResp, error)
-	// 创建会话并且保存信息
+	//创建会话并且保存信息
 	SaveAutoReplyMsg(context.Context, *SaveAutoReplyReq) (*MessageResp, error)
-	// 根据消息修改已读状态
+	//根据消息修改已读状态
 	UpdateReadById(context.Context, *ReadStateReq) (*CurrencyResp, error)
-	// 群组列表查询
+	//群组列表查询
 	ChatGroupList(context.Context, *ChatGroupListReq) (*ChatGroupListResp, error)
-	// 群组新增
+	//群组新增
 	ChatGroupAdd(context.Context, *ChatGroupAddReq) (*CommonReq, error)
-	// 群组成员查询
+	//群组成员查询
 	ChatGroupPerson(context.Context, *ChatGroupPersonReq) (*ChatGroupPersonResp, error)
-	// 加入群组
+	//加入群组
 	ChatGroupJoin(context.Context, *ChatGroupJoinReq) (*CommonReq, error)
-	// 群组名称修改
+	//群组名称修改
 	GroupNameUpdate(context.Context, *GroupNameUpdateReq) (*CommonReq, error)
-	// 群任务新增
+	//群任务新增
 	GroupNoticeAdd(context.Context, *GroupNoticeAddReq) (*CommonReq, error)
-	// 群任务编辑
+	//群任务编辑
 	GroupNoticeUpdate(context.Context, *GroupNoticeUpdateReq) (*CommonReq, error)
-	// 群任务详情
+	//群任务详情
 	GroupNoticeGet(context.Context, *ChatGroupPersonReq) (*GroupNoticeGetResp, error)
-	// 通讯录 -企业人员列表
-	EntPersonsList(context.Context, *EntPersonsListReq) (*EntPersonListResp, error)
-	// 用户撤回消息
+	//用户撤回消息
 	WithdrawMessage(context.Context, *ReadWithdrawReq) (*CurrencyResp, error)
 	// 用户评价回复
 	AppraiseMessage(context.Context, *AppraiseReq) (*CurrencyResp, error)
 	// 客服列表查询
 	ConversationList(context.Context, *ConversationReq) (*UserResp, error)
+	// 群聊
+	GroupChat(context.Context, *MessageSaveReq) (*CommonReq, error)
 	mustEmbedUnimplementedMessageCenterServer()
 }
 
@@ -351,9 +351,6 @@ func (UnimplementedMessageCenterServer) GroupNoticeUpdate(context.Context, *Grou
 func (UnimplementedMessageCenterServer) GroupNoticeGet(context.Context, *ChatGroupPersonReq) (*GroupNoticeGetResp, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method GroupNoticeGet not implemented")
 }
-func (UnimplementedMessageCenterServer) EntPersonsList(context.Context, *EntPersonsListReq) (*EntPersonListResp, error) {
-	return nil, status.Errorf(codes.Unimplemented, "method EntPersonsList not implemented")
-}
 func (UnimplementedMessageCenterServer) WithdrawMessage(context.Context, *ReadWithdrawReq) (*CurrencyResp, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method WithdrawMessage not implemented")
 }
@@ -363,6 +360,9 @@ func (UnimplementedMessageCenterServer) AppraiseMessage(context.Context, *Apprai
 func (UnimplementedMessageCenterServer) ConversationList(context.Context, *ConversationReq) (*UserResp, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method ConversationList not implemented")
 }
+func (UnimplementedMessageCenterServer) GroupChat(context.Context, *MessageSaveReq) (*CommonReq, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method GroupChat not implemented")
+}
 func (UnimplementedMessageCenterServer) mustEmbedUnimplementedMessageCenterServer() {}
 
 // UnsafeMessageCenterServer may be embedded to opt out of forward compatibility for this service.
@@ -664,24 +664,6 @@ func _MessageCenter_GroupNoticeGet_Handler(srv interface{}, ctx context.Context,
 	return interceptor(ctx, in, info, handler)
 }
 
-func _MessageCenter_EntPersonsList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
-	in := new(EntPersonsListReq)
-	if err := dec(in); err != nil {
-		return nil, err
-	}
-	if interceptor == nil {
-		return srv.(MessageCenterServer).EntPersonsList(ctx, in)
-	}
-	info := &grpc.UnaryServerInfo{
-		Server:     srv,
-		FullMethod: "/messagecenter.messageCenter/EntPersonsList",
-	}
-	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
-		return srv.(MessageCenterServer).EntPersonsList(ctx, req.(*EntPersonsListReq))
-	}
-	return interceptor(ctx, in, info, handler)
-}
-
 func _MessageCenter_WithdrawMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
 	in := new(ReadWithdrawReq)
 	if err := dec(in); err != nil {
@@ -736,6 +718,24 @@ func _MessageCenter_ConversationList_Handler(srv interface{}, ctx context.Contex
 	return interceptor(ctx, in, info, handler)
 }
 
+func _MessageCenter_GroupChat_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(MessageSaveReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(MessageCenterServer).GroupChat(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/messagecenter.messageCenter/GroupChat",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(MessageCenterServer).GroupChat(ctx, req.(*MessageSaveReq))
+	}
+	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)
@@ -807,10 +807,6 @@ var MessageCenter_ServiceDesc = grpc.ServiceDesc{
 			MethodName: "GroupNoticeGet",
 			Handler:    _MessageCenter_GroupNoticeGet_Handler,
 		},
-		{
-			MethodName: "EntPersonsList",
-			Handler:    _MessageCenter_EntPersonsList_Handler,
-		},
 		{
 			MethodName: "WithdrawMessage",
 			Handler:    _MessageCenter_WithdrawMessage_Handler,
@@ -823,6 +819,10 @@ var MessageCenter_ServiceDesc = grpc.ServiceDesc{
 			MethodName: "ConversationList",
 			Handler:    _MessageCenter_ConversationList_Handler,
 		},
+		{
+			MethodName: "GroupChat",
+			Handler:    _MessageCenter_GroupChat_Handler,
+		},
 	},
 	Streams:  []grpc.StreamDesc{},
 	Metadata: "messagecenter.proto",

+ 14 - 3
service/chat_group.go

@@ -57,7 +57,7 @@ func (b ChatGroupService) ChatGroupAdd(entId, positionId int64, userIdArr []int6
 //群组成员查询
 func (b ChatGroupService) ChatGroupPerson(chatGroupId int64, entId int64, appid string) map[string][]map[string]interface{} {
 	//先查询企业下的人
-	personMap, _ := EntPerson(entId, false)
+	personMap, _, _ := EntPerson(entId, false)
 	//用户下员工查询
 	personData := map[string][]map[string]interface{}{}
 	personList := IC.BaseMysql.SelectBySql("select DISTINCT  a.position_id,a.isgroup_admin,a.iscommon_admin,d.contact as phone   from socialize_chat_group_person  a left JOIN   base_position b on  a.position_id=b.id left join  base_account c  on  c.id=b.account_id  LEFT JOIN base_person d on  c.person_id=d.id where  a.chat_group_id=? and a.status=1 ", chatGroupId)
@@ -184,9 +184,10 @@ func (b ChatGroupService) GroupNoticeGet(chatGroupId int64, appid string) map[st
 }
 
 //企业用户查询
-func EntPerson(entId int64, isAll bool) (map[string]string, map[string]string) {
+func EntPerson(entId int64, isAll bool) (map[string]string, map[string]string, map[int]string) {
 	phoneData := map[string]string{}
 	nameData := map[string]string{}
+	positionData := map[int]string{}
 	//在职人员查询
 	personList := IC.MainMysql.Find(util.ENTNICHE_USER, map[string]interface{}{
 		"ent_Id": entId,
@@ -209,9 +210,19 @@ func EntPerson(entId int64, isAll bool) (map[string]string, map[string]string) {
 				nameData[common.InterfaceToStr(v["name"])] = common.InterfaceToStr(v["phone"])
 			}
 		}
+		//查询企业人员职位
+		positionList := IC.BaseMysql.SelectBySql("SELECT a.phone,b.id FROM base_user a LEFT JOIN base_position b ON a.id = b.user_id WHERE b.ent_id = ?", entId)
+		if positionList != nil && len(*positionList) > 0 {
+			for _, v := range *positionList {
+				positionData[common.IntAll(v["positionId"])] = phoneData[common.ObjToString(v["phone"])]
+			}
+		}
 	}
-	return phoneData, nameData
+
+	return phoneData, nameData, positionData
 }
+
+//用户名换取职位标识(测试)
 func NameToPositionIdp(userName string, entId int64) string {
 	personList := IC.MainMysql.SelectBySql(fmt.Sprintf(" select GROUP_CONCAT(phone) as phone from %s where ent_id=%d and name like '%s'  ", util.ENTNICHE_USER, entId, userName))
 	if len(*personList) > 0 {

+ 0 - 59
service/ent_address_book.go

@@ -1,59 +0,0 @@
-package service
-
-import (
-	"app.yhyue.com/moapp/jybase/go-xweb/log"
-	IC "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/init"
-	"bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/messagecenter"
-)
-
-func (b ChatGroupService) EntPersonsList(param *messagecenter.EntPersonsListReq) {
-	var sql string
-	if param.Name != "" {
-		sql = "SELECT a.id,a.pid,a.name,c.id as user_id,c.name as user_name,c.phone as user_phone,c.power as user_power,e.name as role from entniche_department a " +
-			"INNER JOIN entniche_department_user b on (a.ent_id=? and a.id=b.dept_id) " +
-			"INNER JOIN entniche_user c on (b.user_id=c.id and c.name like '%" + param.Name + "%') " +
-			"LEFT JOIN entniche_user_role d on (c.id=d.user_id) " +
-			"LEFT JOIN entniche_role e on (d.role_id=e.id) " +
-			"order by a.id,convert(c.name using gbk) COLLATE gbk_chinese_ci asc"
-	} else {
-		sql = `SELECT a.id,a.pid,a.name,c.id as user_id,c.name as user_name,c.phone as user_phone,c.power as user_power,e.name as role from entniche_department a 
-			INNER JOIN entniche_department_user b on (a.ent_id=? and a.id=b.dept_id) 
-			INNER JOIN entniche_user c on (b.user_id=c.id) 
-			LEFT JOIN entniche_user_role d on (c.id=d.user_id) 
-			LEFT JOIN entniche_role e on (d.role_id=e.id) 
-			order by a.id,convert(c.name using gbk) COLLATE gbk_chinese_ci asc`
-	}
-	data := IC.MainMysql.SelectBySql(sql, param.EntId)
-	if data != nil && len(*data) > 0 {
-		for _, v := range *data {
-			log.Println(v)
-			//id := cm.IntAll(v["id"])
-
-			/*user := map[string]interface{}{
-				"user_id":  cm.IntAll(v["user_id"]),
-				"power":    user_power,
-				"username": cm.ObjToString(v["user_name"]),
-				"phone":    cm.ObjToString(v["user_phone"]),
-				"role":     cm.ObjToString(v["role"]),
-			}
-			//log.Println("权限:", user_power)
-
-			list = append(list, map[string]interface{}{
-				"id":    id,
-				"pid":   cm.IntAll(v["pid"]),
-				"name":  cm.ObjToString(v["name"]),
-				"users": []map[string]interface{}{user},
-			})*/
-		}
-	}
-
-	//log.Println(checkedArr)
-	/*this.ServeJson(Result{Data: M{
-		"entname":     this.GetSession("entName"),
-		"checked":     checked,
-		"quota":       VarEntInfo.GetById(entId).Quota,
-		"mystaff":     Mysql.Count(Entniche_user, map[string]interface{}{"ent_id": entId}),
-		"list":        list,
-		"checkedList": checkedArr,
-	}})*/
-}

+ 0 - 34
service/ent_address_book_test.go

@@ -1,34 +0,0 @@
-package service
-
-import (
-	"bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/messagecenter"
-	"testing"
-)
-
-func TestChatGroupService_EntPersonsList(t *testing.T) {
-	type args struct {
-		param *messagecenter.EntPersonsListReq
-	}
-	tests := []struct {
-		name string
-		args args
-	}{
-		// TODO: Add test cases.
-		{
-			name: "企业列表",
-			args: args{
-				&messagecenter.EntPersonsListReq{
-					EntId:   14929,
-					Name:    "",
-					GroupId: 0,
-				},
-			},
-		},
-	}
-	for _, tt := range tests {
-		t.Run(tt.name, func(t *testing.T) {
-			b := ChatGroupService{}
-			b.EntPersonsList(tt.args.param)
-		})
-	}
-}

+ 198 - 25
service/message_mail_box.go

@@ -1,17 +1,21 @@
 package service
 
 import (
-	quitl "app.yhyue.com/moapp/jybase/common"
-	"app.yhyue.com/moapp/jybase/encrypt"
-	util "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/entity"
-	IC "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/init"
-	"bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/messagecenter"
 	"database/sql"
 	"fmt"
 	"log"
+	"strconv"
 	"strings"
 	"sync"
 	"time"
+
+	quitl "app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/date"
+	"app.yhyue.com/moapp/jybase/encrypt"
+	util "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/entity"
+	IC "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/init"
+	"bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/messagecenter"
+	"github.com/gogf/gf/v2/util/gconv"
 )
 
 type MessaggeService struct{}
@@ -565,6 +569,7 @@ func UserSynchronousList(customerServiceId, userId, entId, messageId int64, crea
 func (b MessaggeService) FindMessage(in *messagecenter.MessageReq) *[]map[string]interface{} {
 	sqlStr := ""
 	lastStr := ""
+	positionStr := ""
 	if in.LastId > 0 {
 		if in.Sort == "asc" {
 			lastStr = fmt.Sprintf("AND  a.messag_id > %d ", in.LastId)
@@ -587,7 +592,34 @@ func (b MessaggeService) FindMessage(in *messagecenter.MessageReq) *[]map[string
 			util.SOCIALIZE_MESSAGE_MAILBOX, util.SOCIALIZE_MESSAGE, util.BASE_USER, util.BASE_USER,
 			in.NewUserId, in.NewUserId, in.SendId, in.SendId, in.NewUserId, lastStr, in.PageSize)
 		break
+	case 3: //群聊天
+
+		sqlStr = fmt.Sprintf("SELECT a.messag_id AS messageId,b.*,"+
+			"IF ( a.own_id = a.send_user_id, 1, 2 ) AS fool,"+
+			"IF ( a.own_id = a.send_user_id, 0, a.send_user_id ) AS send_position_id,"+
+			"a.send_user_type,a.type AS itemType FROM %s a "+
+			"LEFT JOIN %s b ON a.messag_id = b.id "+
+			"WHERE a.own_type = 1 AND a.own_id = %d "+
+			"AND chat_group_id = %d AND a.type IN ( 3, 6 ) "+
+			"ORDER BY a.create_time desc,a.id DESC "+
+			"LIMIT 0, %d",
+			util.SOCIALIZE_MESSAGE_MAILBOX, util.SOCIALIZE_MESSAGE, in.SendId,
+			in.ChatGroupId, in.PageSize)
 	case 4, 5, 6, 7: //客服聊天
+		//查询用户所有的职位id
+		sqlPosition := fmt.Sprintf("SELECT b.id FROM %s a LEFT JOIN %s b ON a.id = b.user_id "+
+			"WHERE a.phone = (SELECT a.phone FROM %s a LEFT JOIN %s b ON a.id = b.user_id "+
+			"WHERE b.id = %d)",
+			util.BASE_USER, util.BASE_POSITION, util.BASE_USER, util.BASE_POSITION, in.NewUserId)
+		positionArr := IC.BaseMysql.SelectBySql(sqlPosition)
+		for k, val := range *positionArr {
+			if k < len(*positionArr)-1 {
+				positionStr += quitl.ObjToString(val["id"]) + ","
+			} else {
+				positionStr += quitl.ObjToString(val["id"])
+			}
+		}
+
 		if in.UserType == 1 {
 			//客服聊天记录查看
 			sqlStr = fmt.Sprintf("SELECT   a.messag_id as messageId,b.*,   IF   ( a.own_id = a.send_user_id, 1, 2 ) AS fool,   a.send_user_type,   a.type AS itemType,   '' AS robotName,   '' AS robotImg,   c.customer_service_name AS setName ,   c.user_id   "+
@@ -597,11 +629,11 @@ func (b MessaggeService) FindMessage(in *messagecenter.MessageReq) *[]map[string
 				"WHERE   a.own_type = 1 and a.iswithdraw = 0  "+
 				"AND (a.type = 5 or a.type=4 or a.type=6 or  a.type=7 or a.type=8 )   "+
 				"AND c.ent_id =   %d "+
-				"AND c.user_id =   %d  %s "+
-				"ORDER BY a.create_time desc ,a.id asc "+
+				"AND c.user_id in (%s)  %s "+
+				"ORDER BY a.create_time desc ,a.id   asc "+
 				"limit 0 ,  %d ",
 				util.SOCIALIZE_MESSAGE_MAILBOX, util.SOCIALIZE_MESSAGE, util.SOCIALIZE_CHAT_SESSION,
-				in.EntId, in.SendId, lastStr, in.PageSize)
+				in.EntId, positionStr, lastStr, in.PageSize)
 		} else {
 			//用户聊天记录查看
 			sqlStr = fmt.Sprintf("SELECT a.messag_id as messageId,e.appraise as appraise, b.*,   IF ( a.own_id = a.send_user_id, 1, 2 ) AS fool ,   a.send_user_type,   a.type as  itemType,   d.nickname as  robotName,   d.headimage as  robotImg,   c.customer_service_name as  setName   "+
@@ -609,21 +641,21 @@ func (b MessaggeService) FindMessage(in *messagecenter.MessageReq) *[]map[string
 				"LEFT JOIN %s b ON a.messag_id = b.id   "+
 				"LEFT JOIN %s c ON   IF   ( a.send_user_type = 1, a.send_user_id, a.receive_user_id ) = c.id AND  c.ent_id = %d AND c.user_id = %d "+
 				"LEFT JOIN  %s d on  c.ent_id=d.ent_id    "+
-				"LEFT JOIN %s e on  e.messag_id=b.id "+
-				"WHERE   a.own_type = 2  and a.iswithdraw = 0  "+
-				"AND a.own_id =  %d "+
+				"WHERE   a.own_type = 2    "+
+				"AND a.own_id in  (%s) "+
 				"AND  c.ent_id = %d "+
-				"AND c.user_id =  %d "+
-				"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 "+
+				"AND c.user_id in  (%s) "+
+				"AND ( a.type = 4 OR a.type = 5 or a.type=6 or  a.type=7)  %s "+
+				"ORDER BY a.create_time desc ,a.id   asc "+
 				"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)
+				util.SOCIALIZE_MESSAGE_MAILBOX, util.SOCIALIZE_MESSAGE, util.SOCIALIZE_CHAT_SESSION, in.SendId, in.NewUserId, util.SOCIALIZE_TENANT_ROBOT,
+				positionStr, in.SendId, positionStr, lastStr, in.PageSize)
 		}
 		break
 	}
 	log.Println(sqlStr)
 	data := IC.BaseMysql.SelectBySql(sqlStr)
+	//查询非自己发送消息得发送人名字
 	//自己头像处理
 	if in.UserType == 2 {
 		userData := IC.BaseMysql.FindOne(util.BASE_USER, map[string]interface{}{"id": in.NewUserId}, "headimg", "")
@@ -634,6 +666,15 @@ func (b MessaggeService) FindMessage(in *messagecenter.MessageReq) *[]map[string
 		}
 
 	}
+	if in.MsgType == 3 && data != nil && len(*data) > 0 {
+		_, _, positionData := EntPerson(in.EntId, true)
+		for _, v := range *data {
+			positionId := quitl.IntAll(v["send_user_id"])
+			if positionId != 0 {
+				v["userName"] = positionData[positionId]
+			}
+		}
+	}
 	go func() {
 		updateMap := map[string]interface{}{}
 		if len(*data) > 0 && data != nil {
@@ -642,34 +683,42 @@ func (b MessaggeService) FindMessage(in *messagecenter.MessageReq) *[]map[string
 			switch in.MsgType {
 			case 2: //点对点聊天
 				updateMap = map[string]interface{}{
-					"own_type": 2,
-					"own_id":   in.NewUserId,
-					"type":     2,
-					"isread":   0,
+					"own_type":     2,
+					"own_id":       in.NewUserId,
+					"send_user_id": in.SendId,
+					"type":         2,
+					"isread":       0,
 				}
 				IC.BaseMysql.Update(util.SOCIALIZE_MESSAGE_MAILBOX, updateMap, map[string]interface{}{"isread": 1, "read_time": time.Now().Local().Format(util.Date_Full_Layout)})
 				break
-			case 4, 5:
+			case 3: //群聊天
+				sqlStr = fmt.Sprintf("UPDATE %s a  SET a.isread = 1, a.read_time = now( ) "+
+					"WHERE a.own_type = 1 "+
+					"AND a.type IN (3,6) "+
+					"AND a.isread = 0 "+
+					"AND a.own_id = %d AND a.chat_group_id = %d",
+					util.SOCIALIZE_MESSAGE_MAILBOX, in.SendId, in.ChatGroupId)
+			case 4, 5: //UserType 2用户1客服
 				sqlStr := ""
 				if in.UserType == 1 {
 					sqlStr = fmt.Sprintf("UPDATE %s a  SET a.isread = 1,    a.read_time = now( )  "+
 						"WHERE    a.own_type = 1 and a.iswithdraw = 0 "+
 						"AND a.type IN ( 4,5,6,7)  "+
 						"AND a.isread = 0    "+
-						"AND a.own_id IN ( SELECT b.id FROM %s b WHERE   b.customer_service_id=%d AND    b.user_id=%d  )",
-						util.SOCIALIZE_MESSAGE_MAILBOX, util.SOCIALIZE_CHAT_SESSION, in.EntUserId, in.SendId)
+						"AND a.own_id IN ( SELECT b.id FROM %s b WHERE   b.customer_service_id=%d AND    b.user_id in (%s) )",
+						util.SOCIALIZE_MESSAGE_MAILBOX, util.SOCIALIZE_CHAT_SESSION, in.EntUserId, positionStr)
 				} else {
 					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 =%d ", util.SOCIALIZE_MESSAGE_MAILBOX, in.NewUserId)
+						"AND a.own_id  in (%s) ", util.SOCIALIZE_MESSAGE_MAILBOX, positionStr)
 				}
 				IC.BaseMysql.UpdateOrDeleteBySql(sqlStr)
 				break
 			}
 			//redis缓存处理
-			b.Count(in.NewUserId, in.UserType, in.EntUserId, true)
+			//b.Count(in.NewUserId, in.UserType, in.EntUserId, true)
 		}
 	}()
 	return data
@@ -893,3 +942,127 @@ func NewEndId(messageId, iType int64) (newUserId, entUserId int64) {
 	}
 	return
 }
+
+// 聊天
+// 包含 1v1 ,群聊,群发
+/*
+入参 appid,title,content,sendid,link,item,messagetype,receiverIds,groupIds
+*/
+func (this *MessaggeService) Chat(in *messagecenter.MessageSaveReq) bool {
+	return IC.BaseMysql.ExecTx("消息存储", func(tx *sql.Tx) bool {
+		nowTime := time.Now().Format(date.Date_Full_Layout)
+		isGroup := len(in.GroupIds) > 0
+		isOneToOne := len(in.ReceiverIds) > 0
+		createperson := strconv.Itoa(int(in.SendId))
+		messageId := MessageAdd(tx, in.Appid, in.Title, in.Content, createperson, in.Link, in.Item, in.MessageType)
+		//是否客服介入
+		isCustomerServiceAccess := 0
+
+		//群聊
+		if isGroup {
+			fieids := []string{"appid", "messag_id", "type", "send_user_id", "send_user_type", "receive_user_id", "receive_user_type", "own_type", "own_id", "create_time", "chat_group_id", "isread"}
+			for _, v := range in.GroupIds {
+				args := []interface{}{}
+				summaryArgs := []interface{}{}
+				args = append(args, in.Appid, messageId, in.Type, in.SendId, 2, in.SendId, 2, 2, in.SendId, nowTime, v, 1)
+				groupUser := GetUserByGroupId(tx, v, in.SendId)
+				for _, vv := range groupUser {
+					log.Println("获取到群组下员工:", vv)
+					args = append(args, in.Appid, messageId, in.Type, in.SendId, 2, vv, 2, 2, vv, nowTime, v, 0)
+				}
+				summaryArgs = append(summaryArgs, in.SendId, nil, nil, v, messageId, nil, isCustomerServiceAccess, nowTime)
+				MessageMailBoxAdd(tx, fieids, args)
+				//最后一次聊天
+				SocializeSummaryAdd(tx, summaryArgs)
+				//更新未读消息
+				GroupUserUnReadUpdate(tx, groupUser)
+			}
+		}
+		//1v1
+		if isOneToOne {
+			fieids := []string{"appid", "messag_id", "type", "send_user_id", "send_user_type", "receive_user_id", "receive_user_type", "own_type", "own_id", "create_time", "isread"}
+			args := []interface{}{}
+			summaryArgs := []interface{}{}
+			args = append(args, in.Appid, messageId, in.Type, in.SendId, 2, in.SendId, 2, 2, in.SendId, nowTime, 1)
+			for _, v := range in.ReceiverIds {
+				args = append(args, in.Appid, messageId, in.Type, in.SendId, 2, v, 2, 2, v, nowTime, 0)
+				//发送方,未读消息应该是0
+				summaryArgs = append(summaryArgs, in.SendId, v, nil, nil, messageId, 0, isCustomerServiceAccess, nowTime)
+				//接收方,未读消息应该是1
+				summaryArgs = append(summaryArgs, v, in.SendId, nil, nil, messageId, 1, isCustomerServiceAccess, nowTime)
+			}
+			MessageMailBoxAdd(tx, fieids, args)
+			//最后一次聊天
+			SocializeSummaryAdd(tx, summaryArgs)
+		}
+		return true
+	})
+}
+
+// 消息存储
+func MessageAdd(tx *sql.Tx, appid, title, content, createperson, link string, item, messageType int64) int64 {
+	nowTime := time.Now()
+	message := map[string]interface{}{
+		"appid":         appid,
+		"title":         title,
+		"content":       content,
+		"item":          item,
+		"type":          messageType,
+		"link":          link,
+		"create_time":   nowTime.Format(date.Date_Full_Layout),
+		"create_person": createperson, //系统消息时,创建人是群聊id或接收人id
+	}
+	return IC.BaseMysql.InsertByTx(tx, util.SOCIALIZE_MESSAGE, message)
+}
+
+// 消息信息箱存储
+// types 2:点对点 3:群消息
+func MessageMailBoxAdd(tx *sql.Tx, fieids []string, args []interface{}) (int64, int64) {
+	length, lastId := IC.BaseMysql.InsertBatchByTx(tx, util.SOCIALIZE_MESSAGE_MAILBOX, fieids, args)
+	log.Println("MessageMailBoxAdd length:", length, "MessageMailBoxAdd lastId:", lastId)
+	return length, lastId
+}
+
+// 获取除发送人以外的群成员
+func GetUserByGroupId(tx *sql.Tx, groupId, sendId int64) []int64 {
+	arr := []int64{}
+	data := IC.BaseMysql.SelectBySqlByTx(tx, "select position_id from "+util.SOCIALIZE_CHAT_GROUP_PERSON+" where status = 1 and chat_group_id = ? AND position_id != ? ", groupId, sendId)
+	log.Println("~~~~", data)
+	if data == nil || len(*data) <= 0 {
+		return arr
+	}
+	for _, v := range *data {
+		position_id := quitl.Int64All(v["position_id"])
+		if position_id == 0 {
+			continue
+		}
+		arr = append(arr, position_id)
+	}
+	return arr
+}
+
+//最后一次聊天存储
+func SocializeSummaryAdd(tx *sql.Tx, args []interface{}) (int64, int64) {
+	fieids := []string{"my_position_id", "your_position_id", "ent_id", "chat_group_id", "message_id", "unread", "customer_service_access", "timestamp"}
+
+	length, lastId := IC.BaseMysql.InsertBatchByTx(tx, util.SOCIALIZE_SUMMARY, fieids, args)
+
+	log.Println("SocializeSummaryAdd length:", length, "SocializeSummaryAdd lastId:", lastId)
+
+	return length, lastId
+}
+
+//群组人员未读消息更新
+func GroupUserUnReadUpdate(tx *sql.Tx, ids []int64) bool {
+	whs := []string{}
+	for i := 0; i < len(ids); i++ {
+		whs = append(whs, "?")
+	}
+	wh := strings.Join(whs, ",")
+	interfaces := gconv.Interfaces(ids)
+	count := IC.BaseMysql.UpdateOrDeleteBySql(`UPDATE `+util.SOCIALIZE_CHAT_GROUP_PERSON+` SET unread = unread + 1 WHERE id in (`+wh+`)`, interfaces...)
+	if count > 0 {
+		return true
+	}
+	return true
+}

+ 48 - 5
service/message_mail_box_test.go

@@ -1,15 +1,16 @@
 package service
 
 import (
+	"log"
+	"reflect"
+	"strings"
+	"testing"
+
 	"app.yhyue.com/moapp/jybase/mysql"
 	"app.yhyue.com/moapp/jybase/redis"
 	IC "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/init"
 	"bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/messagecenter"
 	_ "github.com/go-sql-driver/mysql"
-	"log"
-	"reflect"
-	"strings"
-	"testing"
 )
 
 func initMysql() {
@@ -31,7 +32,7 @@ func initMysql() {
 		MaxIdleConns: 5,
 	}
 	IC.MainMysql.Init()
-	redis.InitRedisBySize(strings.Join([]string{"other=127.0.0.1:6379"}, ","), 100, 30, 300)
+	redis.InitRedisBySize(strings.Join([]string{"other=192.168.3.11:1712"}, ","), 100, 30, 300)
 }
 func init() {
 	initMysql()
@@ -155,6 +156,7 @@ func TestMessaggeService_CreateChatSession(t *testing.T) {
 	}
 }
 
+/*
 func TestMessaggeService_FindMessage(t *testing.T) {
 	type args struct {
 		in *messagecenter.MessageReq
@@ -264,6 +266,8 @@ func TestMessaggeService_FindMessage(t *testing.T) {
 	}
 }
 
+*/
+
 func TestMessaggeService_SaveAutoReplyMsg(t *testing.T) {
 	type args struct {
 		userType  int64
@@ -642,3 +646,42 @@ func TestMessaggeService_UpdateReadById(t *testing.T) {
 		})
 	}
 }
+
+func TestChat(t *testing.T) {
+	type args struct {
+		in *messagecenter.MessageSaveReq
+	}
+	tests := []struct {
+		name          string
+		args          args
+		wantErrorCode bool
+		wantErrorMsg  string
+		wantContent   string
+		wantMessageId int64
+	}{
+		{name: "发送群聊",
+			args: args{
+				in: &messagecenter.MessageSaveReq{
+					Title:       "标题?",
+					Content:     "hello world1",
+					Item:        8,
+					MessageType: 1,
+					Link:        "",
+					Appid:       "10000",
+					ReceiverIds: []int64{1, 2, 3},
+					GroupIds:    []int64{8},
+					Type:        1,
+					SendId:      333,
+				},
+			},
+		},
+	}
+
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			b := MessaggeService{}
+			b.Chat(tt.args.in)
+
+		})
+	}
+}

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff