Quellcode durchsuchen

feat:代办消息数量

wangchuanjin vor 1 Jahr
Ursprung
Commit
cd94a79ad8

+ 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"
 )
@@ -52,6 +53,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

@@ -113,6 +113,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

@@ -117,6 +117,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"`

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

@@ -96,17 +96,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{}{
@@ -194,6 +196,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"])
@@ -258,6 +261,7 @@ func UserMsgList(this *message.UserMsgListReq) *message.UserMsgList {
 	}
 
 	data.Unread = unread
+	data.ToDoUnread = toDoUnread
 	return data
 }
 

+ 2 - 0
rpc/message.proto

@@ -207,6 +207,7 @@ message UserMsgListRes {
     repeated AllSortData column = 5; //
     int64 count = 6; //总数
     int64 unread = 7; //未读总数
+    int64 toDoUnread = 8; //待办未读数量
 }
 
 message UserMsgList {
@@ -214,6 +215,7 @@ message UserMsgList {
     repeated AllSortData sortData = 2; //
     int64 count = 3; //总数
     int64 unread = 4; //未读总数
+    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
@@ -1927,13 +1927,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() {
@@ -2017,15 +2018,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"`         //未读总数
+	ToDoUnread int64          `protobuf:"varint,5,opt,name=toDoUnread,proto3" json:"toDoUnread,omitempty"` //待办未读数量
 }
 
 func (x *UserMsgList) Reset() {
@@ -2088,6 +2097,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
@@ -3118,7 +3134,7 @@ var file_message_proto_rawDesc = []byte{
 	0x69, 0x73, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x4c, 0x65, 0x74, 0x74, 0x65, 0x72, 0x12,
 	0x24, 0x0a, 0x0d, 0x69, 0x73, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68,
 	0x18, 0x0f, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x69, 0x73, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x53,
-	0x65, 0x61, 0x72, 0x63, 0x68, 0x22, 0xe8, 0x01, 0x0a, 0x0e, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x73,
+	0x65, 0x61, 0x72, 0x63, 0x68, 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, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d,
@@ -3133,7 +3149,9 @@ var file_message_proto_rawDesc = []byte{
 	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, 0x72, 0x4d, 0x73, 0x67, 0x4c, 0x69, 0x73, 0x74,
+	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, 0x30, 0x0a, 0x08, 0x73, 0x6f, 0x72, 0x74, 0x44,
@@ -3142,7 +3160,9 @@ var file_message_proto_rawDesc = []byte{
 	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, 0xc2, 0x01, 0x0a, 0x0b, 0x41, 0x6c, 0x6c, 0x53,
+	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, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12,

+ 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