Browse Source

fix:最新未读消息修改

duxin 2 years ago
parent
commit
83c18393fd
2 changed files with 28 additions and 32 deletions
  1. 28 29
      rpc/internal/common/sendMsg.go
  2. 0 3
      rpc/internal/logic/usermsglistlogic.go

+ 28 - 29
rpc/internal/common/sendMsg.go

@@ -305,37 +305,36 @@ func UserUnreadMsgList(this *message.UserUnreadMsgListReq) (int64, []*message.Me
 }
 }
 
 
 func MessageGetLast(this *message.UserMsgListReq) *message.Messages {
 func MessageGetLast(this *message.UserMsgListReq) *message.Messages {
-	if this.IsColumn {
-		query := map[string]interface{}{
-			"receive_userid": this.UserId,
-			"isdel":          1,
-			"appid":          this.Appid,
-			"isRead":         0,
-			"msg_type":       1,
-		}
-		lastMsg := entity.Mysql.FindOne("message", query, "", "createtime desc")
-		if lastMsg != nil && len(*lastMsg) > 0 {
-			_id := util.Int64All((*lastMsg)["id"])
-			id := strconv.FormatInt(_id, 10)
-			msg := message.Messages{
-				Id:            id,
-				Appid:         common.InterfaceToStr((*lastMsg)["appid"]),
-				ReceiveUserId: common.InterfaceToStr((*lastMsg)["receive_userid"]),
-				ReceiveName:   common.InterfaceToStr((*lastMsg)["receive_name"]),
-				SendUserId:    common.InterfaceToStr((*lastMsg)["send_userid"]),
-				SendName:      common.InterfaceToStr((*lastMsg)["send_name"]),
-				Createtime:    common.InterfaceToStr((*lastMsg)["createtime"]),
-				Title:         common.InterfaceToStr((*lastMsg)["title"]),
-				MsgType:       common.Int64All((*lastMsg)["msg_type"]),
-				Link:          common.InterfaceToStr((*lastMsg)["link"]),
-				CiteId:        common.Int64All((*lastMsg)["cite_id"]),
-				Content:       common.InterfaceToStr((*lastMsg)["content"]),
-				IsRead:        common.Int64All((*lastMsg)["isRead"]),
-				MsgLogId:      common.Int64All((*lastMsg)["msg_log_id"]),
-			}
-			return &msg
+	query := map[string]interface{}{
+		"receive_userid": this.UserId,
+		"isdel":          1,
+		"appid":          this.Appid,
+		"isRead":         0,
+		"msg_type":       1,
+	}
+	lastMsg := entity.Mysql.FindOne("message", query, "", "createtime desc")
+	if lastMsg != nil && len(*lastMsg) > 0 {
+		_id := util.Int64All((*lastMsg)["id"])
+		id := strconv.FormatInt(_id, 10)
+		msg := message.Messages{
+			Id:            id,
+			Appid:         common.InterfaceToStr((*lastMsg)["appid"]),
+			ReceiveUserId: common.InterfaceToStr((*lastMsg)["receive_userid"]),
+			ReceiveName:   common.InterfaceToStr((*lastMsg)["receive_name"]),
+			SendUserId:    common.InterfaceToStr((*lastMsg)["send_userid"]),
+			SendName:      common.InterfaceToStr((*lastMsg)["send_name"]),
+			Createtime:    common.InterfaceToStr((*lastMsg)["createtime"]),
+			Title:         common.InterfaceToStr((*lastMsg)["title"]),
+			MsgType:       common.Int64All((*lastMsg)["msg_type"]),
+			Link:          common.InterfaceToStr((*lastMsg)["link"]),
+			CiteId:        common.Int64All((*lastMsg)["cite_id"]),
+			Content:       common.InterfaceToStr((*lastMsg)["content"]),
+			IsRead:        common.Int64All((*lastMsg)["isRead"]),
+			MsgLogId:      common.Int64All((*lastMsg)["msg_log_id"]),
 		}
 		}
+		return &msg
 	}
 	}
+
 	return nil
 	return nil
 }
 }
 
 

+ 0 - 3
rpc/internal/logic/usermsglistlogic.go

@@ -27,8 +27,6 @@ func NewUserMsgListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserM
 
 
 // new用户消息列表
 // new用户消息列表
 func (l *UserMsgListLogic) UserMsgList(in *message.UserMsgListReq) (*message.UserMsgListRes, error) {
 func (l *UserMsgListLogic) UserMsgList(in *message.UserMsgListReq) (*message.UserMsgListRes, error) {
-	// todo: add your logic here and delete this line
-
 	data := new(message.UserMsgListRes)
 	data := new(message.UserMsgListRes)
 	res1 := service.UserMsgList(in)    //具体信息
 	res1 := service.UserMsgList(in)    //具体信息
 	res2 := service.MessageGetLast(in) //最新信息
 	res2 := service.MessageGetLast(in) //最新信息
@@ -55,7 +53,6 @@ func (l *UserMsgListLogic) UserMsgList(in *message.UserMsgListReq) (*message.Use
 			"weChatUrl":  weChatUrl4,
 			"weChatUrl":  weChatUrl4,
 		}
 		}
 	}
 	}
-
 	data.Column = res1.SortData
 	data.Column = res1.SortData
 	data.List = finalData
 	data.List = finalData
 	data.Last = res2
 	data.Last = res2