瀏覽代碼

feat: 用户聊天 发送人获取

zhangxinlei1996 2 年之前
父節點
當前提交
774c50132a

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

@@ -49,10 +49,14 @@ func (l *MessageAddLogic) MessageAdd(req *types.MessageEntity) (*types.CommonRes
 	for _, v := range req.GroupIds {
 	for _, v := range req.GroupIds {
 		groupIds = append(groupIds, gconv.Int64(encrypt.SE.Decode4Hex(v)))
 		groupIds = append(groupIds, gconv.Int64(encrypt.SE.Decode4Hex(v)))
 	}
 	}
+	sendId := quitl.Int64All(encrypt.SE.Decode4Hex(req.SendId))
+	if req.SendId == "" {
+		sendId = req.PositionId
+	}
 	resp, err := l.svcCtx.Message.SaveMessage(l.ctx, &messagecenter.MessageEntity{
 	resp, err := l.svcCtx.Message.SaveMessage(l.ctx, &messagecenter.MessageEntity{
 		OwnType:     req.OwnType,
 		OwnType:     req.OwnType,
 		Title:       req.Title,
 		Title:       req.Title,
-		SendId:      quitl.Int64All(encrypt.SE.Decode4Hex(req.SendId)),
+		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)))),
 		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,
 		Item:        req.Item,
 		Type:        quitl.Int64All(quitl.If(req.Type == 5, 1, req.Type)),
 		Type:        quitl.Int64All(quitl.If(req.Type == 5, 1, req.Type)),

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

@@ -46,6 +46,7 @@ type MessageEntity struct {
 	ReceiveId   string   `json:"receiveId,optional"`
 	ReceiveId   string   `json:"receiveId,optional"`
 	ReceiverIds []string `json:"receiverIds,optional"` //个人[可多个]
 	ReceiverIds []string `json:"receiverIds,optional"` //个人[可多个]
 	GroupIds    []string `json:"groupIds,optional"`    //群聊[可多个]
 	GroupIds    []string `json:"groupIds,optional"`    //群聊[可多个]
+	PositionId  int64    `header:"positionId,optional"`
 }
 }
 
 
 type MessageReq struct {
 type MessageReq struct {

+ 1 - 0
api/messagecenter/messagecenter.api

@@ -42,6 +42,7 @@ type MessageEntity {
 	ReceiveId   string   `json:"receiveId,optional"`
 	ReceiveId   string   `json:"receiveId,optional"`
 	ReceiverIds []string `json:"receiverIds,optional"` //个人[可多个]
 	ReceiverIds []string `json:"receiverIds,optional"` //个人[可多个]
 	GroupIds    []string `json:"groupIds,optional"`    //群聊[可多个]
 	GroupIds    []string `json:"groupIds,optional"`    //群聊[可多个]
+	PositionId  int64    `header:"positionId,optional"`
 }
 }
 type MessageReq {
 type MessageReq {
 	MsgType     int64  `json:"msgType"`
 	MsgType     int64  `json:"msgType"`