lianbingjie 1 жил өмнө
parent
commit
5266ee57f2

+ 3 - 1
api/internal/logic/messagelistlogic.go

@@ -1,11 +1,12 @@
 package logic
 
 import (
+	"context"
+
 	"app.yhyue.com/moapp/MessageCenter/api/internal/svc"
 	"app.yhyue.com/moapp/MessageCenter/api/internal/types"
 	"app.yhyue.com/moapp/MessageCenter/entity"
 	"app.yhyue.com/moapp/MessageCenter/rpc/messageclient"
-	"context"
 
 	"github.com/zeromicro/go-zero/core/logx"
 )
@@ -53,6 +54,7 @@ func (l *MessageListLogic) MessageList(req *types.MessageListReq) (resp *types.M
 	result.Message = res.Message
 	result.Total = res.Count
 	result.Unread = res.Unread
+	result.ToDoUnread = res.ToDoUnread
 	if res.List != nil && len(res.List) > 0 {
 		for _, v := range res.List {
 			result.Data = append(result.Data, map[string]interface{}{

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

@@ -114,6 +114,7 @@ type MessageListResp struct {
 	Column        []map[string]interface{} `json:"column"`
 	Unread        int64                    `json:"unread"`
 	RollingTiming int64                    `json:"rollingTiming"`
+	ToDoUnread    int64                    `json:"toDoUnread"`
 }
 
 type WxTmplMessageReq struct {

+ 1 - 0
api/message.api

@@ -118,6 +118,7 @@ type MessageListResp {
 	Column        []map[string]interface{} `json:"column"`
 	Unread        int64                    `json:"unread"`
 	RollingTiming int64                    `json:"rollingTiming"`
+	ToDoUnread    int64                    `json:"toDoUnread"`
 }
 //type UnreadMessageReq {
 //	UserId     string `header:"mgoUserId"`

+ 33 - 21
rpc/internal/common/msglistService.go

@@ -1,6 +1,13 @@
 package common
 
 import (
+	"context"
+	"errors"
+	"fmt"
+	"log"
+	"strconv"
+	"time"
+
 	"app.yhyue.com/moapp/MessageCenter/entity"
 	"app.yhyue.com/moapp/MessageCenter/rpc/internal/config"
 	"app.yhyue.com/moapp/MessageCenter/rpc/type/message"
@@ -8,18 +15,21 @@ import (
 	"app.yhyue.com/moapp/jybase/common"
 	m "app.yhyue.com/moapp/jybase/mongodb"
 	"app.yhyue.com/moapp/jybase/redis"
+<<<<<<< HEAD
 	"context"
 	"encoding/json"
 	"fmt"
 	"log"
 	"strconv"
 	"time"
+=======
+>>>>>>> master
 )
 
 func BitmapUserMsgList(this *message.UserMsgListReq) (*message.UserMsgList, *message.Messages) {
 	var (
-		unread, count int64
-		data          = new(message.UserMsgList)
+		unread, count, toDoUnread int64
+		data                      = new(message.UserMsgList)
 	)
 	//取出用户所有消息、已读消息id bitmap 查库
 	userAllMsgArr, _, userUnreadArr, err := GetUserMsgSummary(this.UserId, this.IsfilterActive)
@@ -37,8 +47,10 @@ func BitmapUserMsgList(this *message.UserMsgListReq) (*message.UserMsgList, *mes
 	//fmt.Println("用户所有消息数:", userAllMsgArr, "已读消息数:", userReadArr, "未读消息数:", userUnreadArr)
 	//导航未读消息总数
 	if !this.IsMsgList && !this.IsColumnNewMsg && !this.IsColumn { //消息未读数统计
-		_, unread = BitmapCountUnread(this.UserId, classUnreadCountMap, true)
+		var sortUnread map[string]int64
+		sortUnread, unread = BitmapCountUnread(this.UserId, classUnreadCountMap, true)
 		data.Unread = unread
+		data.ToDoUnread = sortUnread["11"]
 		return data, nil
 	}
 	//获取栏目下的数据
@@ -131,25 +143,24 @@ func BitmapUserMsgList(this *message.UserMsgListReq) (*message.UserMsgList, *mes
 		sortUnread, total := BitmapCountUnread(this.UserId, classUnreadCountMap, false)
 		//fmt.Println("*************", total)
 		unread += total
-		if this.IsColumn {
-			for _, v := range entity.MessageColumn {
-				var column message.AllSortData
-				column.Name = common.InterfaceToStr(v["name"])
-				column.Img = fmt.Sprintf("/common-module/msgCenter/%s.png", common.InterfaceToStr(v["img"]))
-				column.MsgType = common.Int64All(v["group_id"])
-				if column.Name == "私信" {
-					column.UnreadMessages = unreadMsg(this)
-				} else if common.IntAll(v["group_id"]) > 0 {
-					//消息未读数
-					msgType := common.InterfaceToStr(v["group_id"])
-					column.UnreadMessages = sortUnread[msgType]
-					column.Data = sData[msgType]
-				}
-				if _, ok := entity.ClassSearchMap[column.MsgType]; ok {
-					column.IsClassSearch = true
-				}
-				columnData = append(columnData, &column)
+		toDoUnread = sortUnread["11"]
+		for _, v := range entity.MessageColumn {
+			var column message.AllSortData
+			column.Name = common.InterfaceToStr(v["name"])
+			column.Img = fmt.Sprintf("/common-module/msgCenter/%s.png", common.InterfaceToStr(v["img"]))
+			column.MsgType = common.Int64All(v["group_id"])
+			if column.Name == "私信" {
+				column.UnreadMessages = unreadMsg(this)
+			} else if common.IntAll(v["group_id"]) > 0 {
+				//消息未读数
+				msgType := common.InterfaceToStr(v["group_id"])
+				column.UnreadMessages = sortUnread[msgType]
+				column.Data = sData[msgType]
 			}
+			if _, ok := entity.ClassSearchMap[column.MsgType]; ok {
+				column.IsClassSearch = true
+			}
+			columnData = append(columnData, &column)
 		}
 	}
 	data.SortData = columnData
@@ -257,6 +268,7 @@ func BitmapUserMsgList(this *message.UserMsgListReq) (*message.UserMsgList, *mes
 		}
 	}
 	data.Unread = unread
+	data.ToDoUnread = toDoUnread
 	//置顶消息
 	if len(classUnreadMsgMap[1]) > 0 {
 		activeMsgArr := classUnreadMsgMap[1]

+ 6 - 2
rpc/internal/common/sendMsg.go

@@ -99,17 +99,19 @@ func FindUserMsg(this message.FindUserMsgReq, isClean bool) message.FindUserMsgR
 
 func UserMsgList(this *message.UserMsgListReq) *message.UserMsgList {
 	var (
-		unread, count int64
+		unread, count, toDoUnread int64
 	)
 	m := &MessageService{}
 	data := new(message.UserMsgList)
 	if !this.IsMsgList && !this.IsColumnNewMsg && !this.IsColumn { //消息未读数统计
 		//获取总未读数 初始化
-		_, unread = m.CountUnread(this.UserId, true)
+		var sortUnread map[string]int64
+		sortUnread, unread = m.CountUnread(this.UserId, true)
 		if this.IsContainLetter { //私信统计
 			unread += unreadMsg(this)
 		}
 		data.Unread = unread
+		data.ToDoUnread = sortUnread["11"]
 		return data
 	}
 	cquery := map[string]interface{}{
@@ -197,6 +199,7 @@ func UserMsgList(this *message.UserMsgListReq) *message.UserMsgList {
 	} else if this.IsColumn {
 		//获取所有分类未读数 不初始化
 		sortUnread, _ := m.CountUnread(this.UserId, false)
+		toDoUnread = sortUnread["11"]
 		for _, v := range entity.MessageColumn {
 			var column message.AllSortData
 			column.Name = common.InterfaceToStr(v["name"])
@@ -261,6 +264,7 @@ func UserMsgList(this *message.UserMsgListReq) *message.UserMsgList {
 	}
 
 	data.Unread = unread
+	data.ToDoUnread = toDoUnread
 	return data
 }
 

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

@@ -1,9 +1,10 @@
 package logic
 
 import (
+	"context"
+
 	service "app.yhyue.com/moapp/MessageCenter/rpc/internal/common"
 	"app.yhyue.com/moapp/MessageCenter/util"
-	"context"
 
 	"app.yhyue.com/moapp/MessageCenter/rpc/internal/svc"
 	"app.yhyue.com/moapp/MessageCenter/rpc/type/message"
@@ -59,5 +60,6 @@ func (l *UserMsgListLogic) UserMsgList(in *message.UserMsgListReq) (*message.Use
 	data.Last = res2
 	data.Count = res1.Count
 	data.Unread = res1.Unread
+	data.ToDoUnread = res1.ToDoUnread
 	return data, nil
 }

+ 13 - 11
rpc/message.proto

@@ -200,20 +200,22 @@ message UserMsgListReq {
 }
 
 message UserMsgListRes {
-  int64 code = 1; //状态码
-  string message = 2; //响应消息
-  repeated Messages list = 3; //
-  Messages last = 4; //
-  repeated AllSortData column = 5; //
-  int64 count = 6; //总数
-  int64 unread = 7; //未读总数
+    int64 code = 1; //状态码
+    string message = 2; //响应消息
+    repeated Messages list = 3; //
+    Messages last = 4; //
+    repeated AllSortData column = 5; //
+    int64 count = 6; //总数
+    int64 unread = 7; //未读总数
+    int64 toDoUnread = 8; //待办未读数量
 }
 
 message UserMsgList {
-  repeated Messages data = 1; //
-  repeated AllSortData sortData = 2; //
-  int64 count = 3; //总数
-  int64 unread = 4; //未读总数
+    repeated Messages data = 1; //
+    repeated AllSortData sortData = 2; //
+    int64 count = 3; //总数
+    int64 unread = 4; //未读总数F
+    int64 toDoUnread = 5; //待办未读数量
 }
 
 message AllSortData {

+ 36 - 16
rpc/type/message/message.pb.go

@@ -1,7 +1,7 @@
 // Code generated by protoc-gen-go. DO NOT EDIT.
 // versions:
-// 	protoc-gen-go v1.28.0
-// 	protoc        v3.19.4
+// 	protoc-gen-go v1.27.1
+// 	protoc        v3.20.0--rc2
 // source: message.proto
 
 package message
@@ -1935,13 +1935,14 @@ type UserMsgListRes struct {
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
 
-	Code    int64          `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`      //状态码
-	Message string         `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` //响应消息
-	List    []*Messages    `protobuf:"bytes,3,rep,name=list,proto3" json:"list,omitempty"`       //
-	Last    *Messages      `protobuf:"bytes,4,opt,name=last,proto3" json:"last,omitempty"`       //
-	Column  []*AllSortData `protobuf:"bytes,5,rep,name=column,proto3" json:"column,omitempty"`   //
-	Count   int64          `protobuf:"varint,6,opt,name=count,proto3" json:"count,omitempty"`    //总数
-	Unread  int64          `protobuf:"varint,7,opt,name=unread,proto3" json:"unread,omitempty"`  //未读总数
+	Code       int64          `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`             //状态码
+	Message    string         `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`        //响应消息
+	List       []*Messages    `protobuf:"bytes,3,rep,name=list,proto3" json:"list,omitempty"`              //
+	Last       *Messages      `protobuf:"bytes,4,opt,name=last,proto3" json:"last,omitempty"`              //
+	Column     []*AllSortData `protobuf:"bytes,5,rep,name=column,proto3" json:"column,omitempty"`          //
+	Count      int64          `protobuf:"varint,6,opt,name=count,proto3" json:"count,omitempty"`           //总数
+	Unread     int64          `protobuf:"varint,7,opt,name=unread,proto3" json:"unread,omitempty"`         //未读总数
+	ToDoUnread int64          `protobuf:"varint,8,opt,name=toDoUnread,proto3" json:"toDoUnread,omitempty"` //待办未读数量
 }
 
 func (x *UserMsgListRes) Reset() {
@@ -2025,15 +2026,23 @@ func (x *UserMsgListRes) GetUnread() int64 {
 	return 0
 }
 
+func (x *UserMsgListRes) GetToDoUnread() int64 {
+	if x != nil {
+		return x.ToDoUnread
+	}
+	return 0
+}
+
 type UserMsgList struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
 
-	Data     []*Messages    `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"`         //
-	SortData []*AllSortData `protobuf:"bytes,2,rep,name=sortData,proto3" json:"sortData,omitempty"` //
-	Count    int64          `protobuf:"varint,3,opt,name=count,proto3" json:"count,omitempty"`      //总数
-	Unread   int64          `protobuf:"varint,4,opt,name=unread,proto3" json:"unread,omitempty"`    //未读总数
+	Data       []*Messages    `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"`              //
+	SortData   []*AllSortData `protobuf:"bytes,2,rep,name=sortData,proto3" json:"sortData,omitempty"`      //
+	Count      int64          `protobuf:"varint,3,opt,name=count,proto3" json:"count,omitempty"`           //总数
+	Unread     int64          `protobuf:"varint,4,opt,name=unread,proto3" json:"unread,omitempty"`         //未读总数F
+	ToDoUnread int64          `protobuf:"varint,5,opt,name=toDoUnread,proto3" json:"toDoUnread,omitempty"` //待办未读数量
 }
 
 func (x *UserMsgList) Reset() {
@@ -2096,6 +2105,13 @@ func (x *UserMsgList) GetUnread() int64 {
 	return 0
 }
 
+func (x *UserMsgList) GetToDoUnread() int64 {
+	if x != nil {
+		return x.ToDoUnread
+	}
+	return 0
+}
+
 type AllSortData struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -3286,7 +3302,7 @@ var file_message_proto_rawDesc = []byte{
 	0x18, 0x0f, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x69, 0x73, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x53,
 	0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x26, 0x0a, 0x0e, 0x69, 0x73, 0x66, 0x69, 0x6c, 0x74, 0x65,
 	0x72, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x69,
-	0x73, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x22, 0xe8, 0x01,
+	0x73, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x22, 0x88, 0x02,
 	0x0a, 0x0e, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x73, 0x67, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73,
 	0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04,
 	0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18,
@@ -3301,7 +3317,9 @@ var file_message_proto_rawDesc = []byte{
 	0x74, 0x61, 0x52, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f,
 	0x75, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74,
 	0x12, 0x16, 0x0a, 0x06, 0x75, 0x6e, 0x72, 0x65, 0x61, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03,
-	0x52, 0x06, 0x75, 0x6e, 0x72, 0x65, 0x61, 0x64, 0x22, 0x94, 0x01, 0x0a, 0x0b, 0x55, 0x73, 0x65,
+	0x52, 0x06, 0x75, 0x6e, 0x72, 0x65, 0x61, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x6f, 0x44, 0x6f,
+	0x55, 0x6e, 0x72, 0x65, 0x61, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x74, 0x6f,
+	0x44, 0x6f, 0x55, 0x6e, 0x72, 0x65, 0x61, 0x64, 0x22, 0xb4, 0x01, 0x0a, 0x0b, 0x55, 0x73, 0x65,
 	0x72, 0x4d, 0x73, 0x67, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x25, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61,
 	0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
 	0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12,
@@ -3310,7 +3328,9 @@ var file_message_proto_rawDesc = []byte{
 	0x6f, 0x72, 0x74, 0x44, 0x61, 0x74, 0x61, 0x52, 0x08, 0x73, 0x6f, 0x72, 0x74, 0x44, 0x61, 0x74,
 	0x61, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03,
 	0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x6e, 0x72, 0x65, 0x61,
-	0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x6e, 0x72, 0x65, 0x61, 0x64, 0x22,
+	0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x6e, 0x72, 0x65, 0x61, 0x64, 0x12,
+	0x1e, 0x0a, 0x0a, 0x74, 0x6f, 0x44, 0x6f, 0x55, 0x6e, 0x72, 0x65, 0x61, 0x64, 0x18, 0x05, 0x20,
+	0x01, 0x28, 0x03, 0x52, 0x0a, 0x74, 0x6f, 0x44, 0x6f, 0x55, 0x6e, 0x72, 0x65, 0x61, 0x64, 0x22,
 	0xc2, 0x01, 0x0a, 0x0b, 0x41, 0x6c, 0x6c, 0x53, 0x6f, 0x72, 0x74, 0x44, 0x61, 0x74, 0x61, 0x12,
 	0x26, 0x0a, 0x0e, 0x75, 0x6e, 0x72, 0x65, 0x61, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
 	0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x75, 0x6e, 0x72, 0x65, 0x61, 0x64, 0x4d,

+ 1 - 1
rpc/type/message/message_grpc.pb.go

@@ -1,7 +1,7 @@
 // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
 // versions:
 // - protoc-gen-go-grpc v1.2.0
-// - protoc             v3.19.4
+// - protoc             v3.20.0--rc2
 // source: message.proto
 
 package message