Эх сурвалжийг харах

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

zhangxinlei1996 2 жил өмнө
parent
commit
90ac0b1450

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

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

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

@@ -92,39 +92,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 {
@@ -141,4 +149,5 @@ type AppraiseMessageReq struct {
 	NewUserId int64  `header:"newUserId"`
 	MessageId string `json:"messageId"`
 	Appraise  int64  `json:"appraise,options=-1|1"`
+	Appid         string `header:"appId"`
 }

+ 12 - 4
api/messagecenter/messagecenter.api

@@ -82,33 +82,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 {

+ 1 - 0
rpc/messagecenter/internal/logic/groupnameupdatelogic.go

@@ -30,5 +30,6 @@ func (l *GroupNameUpdateLogic) GroupNameUpdate(in *messagecenter.GroupNameUpdate
 	return &messagecenter.CommonReq{
 		ErrorCode: 0,
 		Status:    status,
+		ErrorMsg:  msg,
 	}, nil
 }

+ 2 - 0
service/chat_group.go

@@ -212,6 +212,8 @@ func EntPerson(entId int64, isAll bool) (map[string]string, map[string]string) {
 	}
 	return phoneData, nameData
 }
+
+//用户名换取职位标识(测试)
 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 {