邮件协议完善

This commit is contained in:
meixiongfeng 2022-06-07 17:28:00 +08:00
parent a534576f46
commit f85141f6f8
11 changed files with 1041 additions and 387 deletions

View File

@ -1,14 +1,25 @@
package mail
import (
"context"
"go_dreamfactory/comm"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
"go_dreamfactory/sys/cache"
"github.com/liwei1dao/lego/core"
"github.com/liwei1dao/lego/sys/log"
)
const (
QueryUserMailReq = "mail.queryusermailreq"
QueryUserMailResp = "mail.queryusermailresp"
QueryUserMailReq = "mail.queryusermailreq"
QueryUserMailResp = "mail.queryusermailresp"
ReadUserMailReq = "mail.readusermailreq"
ReadUserMailResp = "mail.readusermailresp"
GetUserMailAttachmentReq = "mail.getusermailattachmentreq"
GetUserMailAttachmentResp = "mail.getusermailattachmentresp"
DelUserMailReq = "mail.delusermailreq"
DelUserMailResp = "mail.delusermailresp"
)
type Api_Comp struct {
@ -21,3 +32,43 @@ func (this *Api_Comp) Init(service core.IService, module core.IModule, comp core
this.module = module.(*Mail)
return
}
func (this *Api_Comp) QueryUserMailReq(ctx context.Context, session comm.IUserSession, req *pb.QueryUserMailResp) (err error) {
code := pb.ErrorCode_Success
mailinfo := make([]*pb.DB_MailData, 0)
defer func() {
session.SendMsg("mail", "queryusermailresp", code, &pb.QueryUserMailResp{Mails: mailinfo})
}()
if session.GetUserId() == "" {
code = pb.ErrorCode_NoLogin
return
}
if mailinfo, err = cache.Defsys.QueryUserMail(session.GetUserId()); err != nil {
log.Errorf("QueryUserMailResp err:%v", err)
code = pb.ErrorCode_CacheReadError
return
}
return
}
func (this *Api_Comp) ReadUserMailReq(ctx context.Context, session comm.IUserSession, req *pb.ReadUserMailResp) (err error) {
var (
code pb.ErrorCode
mail *pb.DB_MailData
)
defer func() {
session.SendMsg(string(this.module.GetType()), "readusermailresp", code, &pb.ReadUserMailResp{Mail: mail})
}()
return
}
func (this *Api_Comp) GetUserMailAttachmentReq(ctx context.Context, session comm.IUserSession, req *pb.GetUserMailAttachmentResp) (err error) {
return
}
func (this *Api_Comp) DelUserMailReq(ctx context.Context, session comm.IUserSession, req *pb.DelUserMailResp) (err error) {
return
}

View File

@ -1,337 +0,0 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v3.20.0
// source: mail.proto
package pb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type MailAttachment struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Itemid uint32 `protobuf:"varint,1,opt,name=Itemid,proto3" json:"Itemid,omitempty"` // 道具iD
ItemCount uint32 `protobuf:"varint,2,opt,name=ItemCount,proto3" json:"ItemCount,omitempty"` // 数量
}
func (x *MailAttachment) Reset() {
*x = MailAttachment{}
if protoimpl.UnsafeEnabled {
mi := &file_mail_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *MailAttachment) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MailAttachment) ProtoMessage() {}
func (x *MailAttachment) ProtoReflect() protoreflect.Message {
mi := &file_mail_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use MailAttachment.ProtoReflect.Descriptor instead.
func (*MailAttachment) Descriptor() ([]byte, []int) {
return file_mail_proto_rawDescGZIP(), []int{0}
}
func (x *MailAttachment) GetItemid() uint32 {
if x != nil {
return x.Itemid
}
return 0
}
func (x *MailAttachment) GetItemCount() uint32 {
if x != nil {
return x.ItemCount
}
return 0
}
type MailData struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Title string `protobuf:"bytes,1,opt,name=Title,proto3" json:"Title,omitempty"` // 邮件标题
Contex string `protobuf:"bytes,2,opt,name=Contex,proto3" json:"Contex,omitempty"` // 邮件内容
CreateTime uint64 `protobuf:"varint,3,opt,name=CreateTime,proto3" json:"CreateTime,omitempty"` // 发送时间
DueTime uint64 `protobuf:"varint,4,opt,name=DueTime,proto3" json:"DueTime,omitempty"` // 过期时间
Check bool `protobuf:"varint,5,opt,name=Check,proto3" json:"Check,omitempty"` // 是否查看
Items []*MailAttachment `protobuf:"bytes,6,rep,name=Items,proto3" json:"Items,omitempty"` // 附件
}
func (x *MailData) Reset() {
*x = MailData{}
if protoimpl.UnsafeEnabled {
mi := &file_mail_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *MailData) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MailData) ProtoMessage() {}
func (x *MailData) ProtoReflect() protoreflect.Message {
mi := &file_mail_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use MailData.ProtoReflect.Descriptor instead.
func (*MailData) Descriptor() ([]byte, []int) {
return file_mail_proto_rawDescGZIP(), []int{1}
}
func (x *MailData) GetTitle() string {
if x != nil {
return x.Title
}
return ""
}
func (x *MailData) GetContex() string {
if x != nil {
return x.Contex
}
return ""
}
func (x *MailData) GetCreateTime() uint64 {
if x != nil {
return x.CreateTime
}
return 0
}
func (x *MailData) GetDueTime() uint64 {
if x != nil {
return x.DueTime
}
return 0
}
func (x *MailData) GetCheck() bool {
if x != nil {
return x.Check
}
return false
}
func (x *MailData) GetItems() []*MailAttachment {
if x != nil {
return x.Items
}
return nil
}
type DB_UserMailData struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
UserId string `bson:"_id" json:"UserId,omitempty" protobuf:"bytes,1,opt,name=UserId,proto3"` //tags:{bson:"_id"}用户Id
Mails []*MailData `protobuf:"bytes,2,rep,name=mails,proto3" json:"mails,omitempty"` // 邮件列表
}
func (x *DB_UserMailData) Reset() {
*x = DB_UserMailData{}
if protoimpl.UnsafeEnabled {
mi := &file_mail_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DB_UserMailData) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DB_UserMailData) ProtoMessage() {}
func (x *DB_UserMailData) ProtoReflect() protoreflect.Message {
mi := &file_mail_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DB_UserMailData.ProtoReflect.Descriptor instead.
func (*DB_UserMailData) Descriptor() ([]byte, []int) {
return file_mail_proto_rawDescGZIP(), []int{2}
}
func (x *DB_UserMailData) GetUserId() string {
if x != nil {
return x.UserId
}
return ""
}
func (x *DB_UserMailData) GetMails() []*MailData {
if x != nil {
return x.Mails
}
return nil
}
var File_mail_proto protoreflect.FileDescriptor
var file_mail_proto_rawDesc = []byte{
0x0a, 0x0a, 0x6d, 0x61, 0x69, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x46, 0x0a, 0x0e,
0x4d, 0x61, 0x69, 0x6c, 0x41, 0x74, 0x74, 0x61, 0x63, 0x68, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x16,
0x0a, 0x06, 0x49, 0x74, 0x65, 0x6d, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06,
0x49, 0x74, 0x65, 0x6d, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x49, 0x74, 0x65, 0x6d, 0x43, 0x6f,
0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x49, 0x74, 0x65, 0x6d, 0x43,
0x6f, 0x75, 0x6e, 0x74, 0x22, 0xaf, 0x01, 0x0a, 0x08, 0x4d, 0x61, 0x69, 0x6c, 0x44, 0x61, 0x74,
0x61, 0x12, 0x14, 0x0a, 0x05, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x05, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x74, 0x65,
0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x12,
0x1e, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20,
0x01, 0x28, 0x04, 0x52, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12,
0x18, 0x0a, 0x07, 0x44, 0x75, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04,
0x52, 0x07, 0x44, 0x75, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x43, 0x68, 0x65,
0x63, 0x6b, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12,
0x25, 0x0a, 0x05, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f,
0x2e, 0x4d, 0x61, 0x69, 0x6c, 0x41, 0x74, 0x74, 0x61, 0x63, 0x68, 0x6d, 0x65, 0x6e, 0x74, 0x52,
0x05, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x4a, 0x0a, 0x0f, 0x44, 0x42, 0x5f, 0x55, 0x73, 0x65,
0x72, 0x4d, 0x61, 0x69, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x73, 0x65,
0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49,
0x64, 0x12, 0x1f, 0x0a, 0x05, 0x6d, 0x61, 0x69, 0x6c, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b,
0x32, 0x09, 0x2e, 0x4d, 0x61, 0x69, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x52, 0x05, 0x6d, 0x61, 0x69,
0x6c, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x33,
}
var (
file_mail_proto_rawDescOnce sync.Once
file_mail_proto_rawDescData = file_mail_proto_rawDesc
)
func file_mail_proto_rawDescGZIP() []byte {
file_mail_proto_rawDescOnce.Do(func() {
file_mail_proto_rawDescData = protoimpl.X.CompressGZIP(file_mail_proto_rawDescData)
})
return file_mail_proto_rawDescData
}
var file_mail_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_mail_proto_goTypes = []interface{}{
(*MailAttachment)(nil), // 0: MailAttachment
(*MailData)(nil), // 1: MailData
(*DB_UserMailData)(nil), // 2: DB_UserMailData
}
var file_mail_proto_depIdxs = []int32{
0, // 0: MailData.Items:type_name -> MailAttachment
1, // 1: DB_UserMailData.mails:type_name -> MailData
2, // [2:2] is the sub-list for method output_type
2, // [2:2] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_mail_proto_init() }
func file_mail_proto_init() {
if File_mail_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_mail_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MailAttachment); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_mail_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MailData); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_mail_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DB_UserMailData); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_mail_proto_rawDesc,
NumEnums: 0,
NumMessages: 3,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_mail_proto_goTypes,
DependencyIndexes: file_mail_proto_depIdxs,
MessageInfos: file_mail_proto_msgTypes,
}.Build()
File_mail_proto = out.File
file_mail_proto_rawDesc = nil
file_mail_proto_goTypes = nil
file_mail_proto_depIdxs = nil
}

282
pb/mail_db.pb.go Normal file
View File

@ -0,0 +1,282 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v3.20.0
// source: mail_db.proto
package pb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type MailAttachment struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ItemId uint32 `protobuf:"varint,1,opt,name=ItemId,proto3" json:"ItemId,omitempty"` // 道具iD
ItemCount uint32 `protobuf:"varint,2,opt,name=ItemCount,proto3" json:"ItemCount,omitempty"` // 数量
}
func (x *MailAttachment) Reset() {
*x = MailAttachment{}
if protoimpl.UnsafeEnabled {
mi := &file_mail_db_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *MailAttachment) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MailAttachment) ProtoMessage() {}
func (x *MailAttachment) ProtoReflect() protoreflect.Message {
mi := &file_mail_db_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use MailAttachment.ProtoReflect.Descriptor instead.
func (*MailAttachment) Descriptor() ([]byte, []int) {
return file_mail_db_proto_rawDescGZIP(), []int{0}
}
func (x *MailAttachment) GetItemId() uint32 {
if x != nil {
return x.ItemId
}
return 0
}
func (x *MailAttachment) GetItemCount() uint32 {
if x != nil {
return x.ItemCount
}
return 0
}
type DB_MailData struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ObjId string `bson:"_id" json:"ObjId,omitempty" protobuf:"bytes,1,opt,name=ObjId,proto3"` // tags:{bson:"_id"}
UserId string `protobuf:"bytes,2,opt,name=UserId,proto3" json:"UserId,omitempty"`
Title string `protobuf:"bytes,3,opt,name=Title,proto3" json:"Title,omitempty"` // 邮件标题
Contex string `protobuf:"bytes,4,opt,name=Contex,proto3" json:"Contex,omitempty"` // 邮件内容
CreateTime uint64 `protobuf:"varint,5,opt,name=CreateTime,proto3" json:"CreateTime,omitempty"` // 发送时间
DueTime uint64 `protobuf:"varint,6,opt,name=DueTime,proto3" json:"DueTime,omitempty"` // 过期时间
Check bool `protobuf:"varint,7,opt,name=Check,proto3" json:"Check,omitempty"` // 是否查看
Items []*MailAttachment `protobuf:"bytes,8,rep,name=Items,proto3" json:"Items,omitempty"` // 附件
}
func (x *DB_MailData) Reset() {
*x = DB_MailData{}
if protoimpl.UnsafeEnabled {
mi := &file_mail_db_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DB_MailData) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DB_MailData) ProtoMessage() {}
func (x *DB_MailData) ProtoReflect() protoreflect.Message {
mi := &file_mail_db_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DB_MailData.ProtoReflect.Descriptor instead.
func (*DB_MailData) Descriptor() ([]byte, []int) {
return file_mail_db_proto_rawDescGZIP(), []int{1}
}
func (x *DB_MailData) GetObjId() string {
if x != nil {
return x.ObjId
}
return ""
}
func (x *DB_MailData) GetUserId() string {
if x != nil {
return x.UserId
}
return ""
}
func (x *DB_MailData) GetTitle() string {
if x != nil {
return x.Title
}
return ""
}
func (x *DB_MailData) GetContex() string {
if x != nil {
return x.Contex
}
return ""
}
func (x *DB_MailData) GetCreateTime() uint64 {
if x != nil {
return x.CreateTime
}
return 0
}
func (x *DB_MailData) GetDueTime() uint64 {
if x != nil {
return x.DueTime
}
return 0
}
func (x *DB_MailData) GetCheck() bool {
if x != nil {
return x.Check
}
return false
}
func (x *DB_MailData) GetItems() []*MailAttachment {
if x != nil {
return x.Items
}
return nil
}
var File_mail_db_proto protoreflect.FileDescriptor
var file_mail_db_proto_rawDesc = []byte{
0x0a, 0x0d, 0x6d, 0x61, 0x69, 0x6c, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22,
0x46, 0x0a, 0x0e, 0x4d, 0x61, 0x69, 0x6c, 0x41, 0x74, 0x74, 0x61, 0x63, 0x68, 0x6d, 0x65, 0x6e,
0x74, 0x12, 0x16, 0x0a, 0x06, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x0d, 0x52, 0x06, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x49, 0x74, 0x65,
0x6d, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x49, 0x74,
0x65, 0x6d, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xe0, 0x01, 0x0a, 0x0b, 0x44, 0x42, 0x5f, 0x4d,
0x61, 0x69, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x4f, 0x62, 0x6a, 0x49, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x4f, 0x62, 0x6a, 0x49, 0x64, 0x12, 0x16, 0x0a,
0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x55,
0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x03,
0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x43,
0x6f, 0x6e, 0x74, 0x65, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x43, 0x6f, 0x6e,
0x74, 0x65, 0x78, 0x12, 0x1e, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d,
0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54,
0x69, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x44, 0x75, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x06,
0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x44, 0x75, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x14, 0x0a,
0x05, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x43, 0x68,
0x65, 0x63, 0x6b, 0x12, 0x25, 0x0a, 0x05, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x08, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x4d, 0x61, 0x69, 0x6c, 0x41, 0x74, 0x74, 0x61, 0x63, 0x68, 0x6d,
0x65, 0x6e, 0x74, 0x52, 0x05, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b,
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_mail_db_proto_rawDescOnce sync.Once
file_mail_db_proto_rawDescData = file_mail_db_proto_rawDesc
)
func file_mail_db_proto_rawDescGZIP() []byte {
file_mail_db_proto_rawDescOnce.Do(func() {
file_mail_db_proto_rawDescData = protoimpl.X.CompressGZIP(file_mail_db_proto_rawDescData)
})
return file_mail_db_proto_rawDescData
}
var file_mail_db_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_mail_db_proto_goTypes = []interface{}{
(*MailAttachment)(nil), // 0: MailAttachment
(*DB_MailData)(nil), // 1: DB_MailData
}
var file_mail_db_proto_depIdxs = []int32{
0, // 0: DB_MailData.Items:type_name -> MailAttachment
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_mail_db_proto_init() }
func file_mail_db_proto_init() {
if File_mail_db_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_mail_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MailAttachment); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_mail_db_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DB_MailData); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_mail_db_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_mail_db_proto_goTypes,
DependencyIndexes: file_mail_db_proto_depIdxs,
MessageInfos: file_mail_db_proto_msgTypes,
}.Build()
File_mail_db_proto = out.File
file_mail_db_proto_rawDesc = nil
file_mail_db_proto_goTypes = nil
file_mail_db_proto_depIdxs = nil
}

584
pb/mail_msg.pb.go Normal file
View File

@ -0,0 +1,584 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v3.20.0
// source: mail_msg.proto
package pb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type QueryUserMailReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *QueryUserMailReq) Reset() {
*x = QueryUserMailReq{}
if protoimpl.UnsafeEnabled {
mi := &file_mail_msg_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *QueryUserMailReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*QueryUserMailReq) ProtoMessage() {}
func (x *QueryUserMailReq) ProtoReflect() protoreflect.Message {
mi := &file_mail_msg_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use QueryUserMailReq.ProtoReflect.Descriptor instead.
func (*QueryUserMailReq) Descriptor() ([]byte, []int) {
return file_mail_msg_proto_rawDescGZIP(), []int{0}
}
// 查询邮件信息
type QueryUserMailResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Mails []*DB_MailData `protobuf:"bytes,1,rep,name=Mails,proto3" json:"Mails,omitempty"`
}
func (x *QueryUserMailResp) Reset() {
*x = QueryUserMailResp{}
if protoimpl.UnsafeEnabled {
mi := &file_mail_msg_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *QueryUserMailResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*QueryUserMailResp) ProtoMessage() {}
func (x *QueryUserMailResp) ProtoReflect() protoreflect.Message {
mi := &file_mail_msg_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use QueryUserMailResp.ProtoReflect.Descriptor instead.
func (*QueryUserMailResp) Descriptor() ([]byte, []int) {
return file_mail_msg_proto_rawDescGZIP(), []int{1}
}
func (x *QueryUserMailResp) GetMails() []*DB_MailData {
if x != nil {
return x.Mails
}
return nil
}
// 查看邮件
type ReadUserMailReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ObjID string `protobuf:"bytes,1,opt,name=ObjID,proto3" json:"ObjID,omitempty"`
}
func (x *ReadUserMailReq) Reset() {
*x = ReadUserMailReq{}
if protoimpl.UnsafeEnabled {
mi := &file_mail_msg_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ReadUserMailReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ReadUserMailReq) ProtoMessage() {}
func (x *ReadUserMailReq) ProtoReflect() protoreflect.Message {
mi := &file_mail_msg_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ReadUserMailReq.ProtoReflect.Descriptor instead.
func (*ReadUserMailReq) Descriptor() ([]byte, []int) {
return file_mail_msg_proto_rawDescGZIP(), []int{2}
}
func (x *ReadUserMailReq) GetObjID() string {
if x != nil {
return x.ObjID
}
return ""
}
type ReadUserMailResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Mail *DB_MailData `protobuf:"bytes,1,opt,name=Mail,proto3" json:"Mail,omitempty"`
}
func (x *ReadUserMailResp) Reset() {
*x = ReadUserMailResp{}
if protoimpl.UnsafeEnabled {
mi := &file_mail_msg_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ReadUserMailResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ReadUserMailResp) ProtoMessage() {}
func (x *ReadUserMailResp) ProtoReflect() protoreflect.Message {
mi := &file_mail_msg_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ReadUserMailResp.ProtoReflect.Descriptor instead.
func (*ReadUserMailResp) Descriptor() ([]byte, []int) {
return file_mail_msg_proto_rawDescGZIP(), []int{3}
}
func (x *ReadUserMailResp) GetMail() *DB_MailData {
if x != nil {
return x.Mail
}
return nil
}
// 领取附件
type GetUserMailAttachmentReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ObjID string `protobuf:"bytes,1,opt,name=ObjID,proto3" json:"ObjID,omitempty"`
}
func (x *GetUserMailAttachmentReq) Reset() {
*x = GetUserMailAttachmentReq{}
if protoimpl.UnsafeEnabled {
mi := &file_mail_msg_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetUserMailAttachmentReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetUserMailAttachmentReq) ProtoMessage() {}
func (x *GetUserMailAttachmentReq) ProtoReflect() protoreflect.Message {
mi := &file_mail_msg_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetUserMailAttachmentReq.ProtoReflect.Descriptor instead.
func (*GetUserMailAttachmentReq) Descriptor() ([]byte, []int) {
return file_mail_msg_proto_rawDescGZIP(), []int{4}
}
func (x *GetUserMailAttachmentReq) GetObjID() string {
if x != nil {
return x.ObjID
}
return ""
}
type GetUserMailAttachmentResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Mail *DB_MailData `protobuf:"bytes,1,opt,name=Mail,proto3" json:"Mail,omitempty"`
}
func (x *GetUserMailAttachmentResp) Reset() {
*x = GetUserMailAttachmentResp{}
if protoimpl.UnsafeEnabled {
mi := &file_mail_msg_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetUserMailAttachmentResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetUserMailAttachmentResp) ProtoMessage() {}
func (x *GetUserMailAttachmentResp) ProtoReflect() protoreflect.Message {
mi := &file_mail_msg_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetUserMailAttachmentResp.ProtoReflect.Descriptor instead.
func (*GetUserMailAttachmentResp) Descriptor() ([]byte, []int) {
return file_mail_msg_proto_rawDescGZIP(), []int{5}
}
func (x *GetUserMailAttachmentResp) GetMail() *DB_MailData {
if x != nil {
return x.Mail
}
return nil
}
// 删除某个邮件
type DelUserMailReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ObjID string `protobuf:"bytes,1,opt,name=ObjID,proto3" json:"ObjID,omitempty"`
}
func (x *DelUserMailReq) Reset() {
*x = DelUserMailReq{}
if protoimpl.UnsafeEnabled {
mi := &file_mail_msg_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DelUserMailReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DelUserMailReq) ProtoMessage() {}
func (x *DelUserMailReq) ProtoReflect() protoreflect.Message {
mi := &file_mail_msg_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DelUserMailReq.ProtoReflect.Descriptor instead.
func (*DelUserMailReq) Descriptor() ([]byte, []int) {
return file_mail_msg_proto_rawDescGZIP(), []int{6}
}
func (x *DelUserMailReq) GetObjID() string {
if x != nil {
return x.ObjID
}
return ""
}
type DelUserMailResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Mail []*DB_MailData `protobuf:"bytes,1,rep,name=Mail,proto3" json:"Mail,omitempty"`
}
func (x *DelUserMailResp) Reset() {
*x = DelUserMailResp{}
if protoimpl.UnsafeEnabled {
mi := &file_mail_msg_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DelUserMailResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DelUserMailResp) ProtoMessage() {}
func (x *DelUserMailResp) ProtoReflect() protoreflect.Message {
mi := &file_mail_msg_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DelUserMailResp.ProtoReflect.Descriptor instead.
func (*DelUserMailResp) Descriptor() ([]byte, []int) {
return file_mail_msg_proto_rawDescGZIP(), []int{7}
}
func (x *DelUserMailResp) GetMail() []*DB_MailData {
if x != nil {
return x.Mail
}
return nil
}
var File_mail_msg_proto protoreflect.FileDescriptor
var file_mail_msg_proto_rawDesc = []byte{
0x0a, 0x0e, 0x6d, 0x61, 0x69, 0x6c, 0x5f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x1a, 0x0d, 0x6d, 0x61, 0x69, 0x6c, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22,
0x12, 0x0a, 0x10, 0x51, 0x75, 0x65, 0x72, 0x79, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x61, 0x69, 0x6c,
0x52, 0x65, 0x71, 0x22, 0x37, 0x0a, 0x11, 0x51, 0x75, 0x65, 0x72, 0x79, 0x55, 0x73, 0x65, 0x72,
0x4d, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x12, 0x22, 0x0a, 0x05, 0x4d, 0x61, 0x69, 0x6c,
0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x44, 0x42, 0x5f, 0x4d, 0x61, 0x69,
0x6c, 0x44, 0x61, 0x74, 0x61, 0x52, 0x05, 0x4d, 0x61, 0x69, 0x6c, 0x73, 0x22, 0x27, 0x0a, 0x0f,
0x52, 0x65, 0x61, 0x64, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x12,
0x14, 0x0a, 0x05, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
0x4f, 0x62, 0x6a, 0x49, 0x44, 0x22, 0x34, 0x0a, 0x10, 0x52, 0x65, 0x61, 0x64, 0x55, 0x73, 0x65,
0x72, 0x4d, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x12, 0x20, 0x0a, 0x04, 0x4d, 0x61, 0x69,
0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x44, 0x42, 0x5f, 0x4d, 0x61, 0x69,
0x6c, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x4d, 0x61, 0x69, 0x6c, 0x22, 0x30, 0x0a, 0x18, 0x47,
0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x61, 0x69, 0x6c, 0x41, 0x74, 0x74, 0x61, 0x63, 0x68,
0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x4f, 0x62, 0x6a, 0x49, 0x44,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x22, 0x3d, 0x0a,
0x19, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x61, 0x69, 0x6c, 0x41, 0x74, 0x74, 0x61,
0x63, 0x68, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x20, 0x0a, 0x04, 0x4d, 0x61,
0x69, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x44, 0x42, 0x5f, 0x4d, 0x61,
0x69, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x4d, 0x61, 0x69, 0x6c, 0x22, 0x26, 0x0a, 0x0e,
0x44, 0x65, 0x6c, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x12, 0x14,
0x0a, 0x05, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x4f,
0x62, 0x6a, 0x49, 0x44, 0x22, 0x33, 0x0a, 0x0f, 0x44, 0x65, 0x6c, 0x55, 0x73, 0x65, 0x72, 0x4d,
0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x12, 0x20, 0x0a, 0x04, 0x4d, 0x61, 0x69, 0x6c, 0x18,
0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x44, 0x42, 0x5f, 0x4d, 0x61, 0x69, 0x6c, 0x44,
0x61, 0x74, 0x61, 0x52, 0x04, 0x4d, 0x61, 0x69, 0x6c, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70,
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_mail_msg_proto_rawDescOnce sync.Once
file_mail_msg_proto_rawDescData = file_mail_msg_proto_rawDesc
)
func file_mail_msg_proto_rawDescGZIP() []byte {
file_mail_msg_proto_rawDescOnce.Do(func() {
file_mail_msg_proto_rawDescData = protoimpl.X.CompressGZIP(file_mail_msg_proto_rawDescData)
})
return file_mail_msg_proto_rawDescData
}
var file_mail_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_mail_msg_proto_goTypes = []interface{}{
(*QueryUserMailReq)(nil), // 0: QueryUserMailReq
(*QueryUserMailResp)(nil), // 1: QueryUserMailResp
(*ReadUserMailReq)(nil), // 2: ReadUserMailReq
(*ReadUserMailResp)(nil), // 3: ReadUserMailResp
(*GetUserMailAttachmentReq)(nil), // 4: GetUserMailAttachmentReq
(*GetUserMailAttachmentResp)(nil), // 5: GetUserMailAttachmentResp
(*DelUserMailReq)(nil), // 6: DelUserMailReq
(*DelUserMailResp)(nil), // 7: DelUserMailResp
(*DB_MailData)(nil), // 8: DB_MailData
}
var file_mail_msg_proto_depIdxs = []int32{
8, // 0: QueryUserMailResp.Mails:type_name -> DB_MailData
8, // 1: ReadUserMailResp.Mail:type_name -> DB_MailData
8, // 2: GetUserMailAttachmentResp.Mail:type_name -> DB_MailData
8, // 3: DelUserMailResp.Mail:type_name -> DB_MailData
4, // [4:4] is the sub-list for method output_type
4, // [4:4] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
}
func init() { file_mail_msg_proto_init() }
func file_mail_msg_proto_init() {
if File_mail_msg_proto != nil {
return
}
file_mail_db_proto_init()
if !protoimpl.UnsafeEnabled {
file_mail_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*QueryUserMailReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_mail_msg_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*QueryUserMailResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_mail_msg_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ReadUserMailReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_mail_msg_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ReadUserMailResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_mail_msg_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetUserMailAttachmentReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_mail_msg_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetUserMailAttachmentResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_mail_msg_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DelUserMailReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_mail_msg_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DelUserMailResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_mail_msg_proto_rawDesc,
NumEnums: 0,
NumMessages: 8,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_mail_msg_proto_goTypes,
DependencyIndexes: file_mail_msg_proto_depIdxs,
MessageInfos: file_mail_msg_proto_msgTypes,
}.Build()
File_mail_msg_proto = out.File
file_mail_msg_proto_rawDesc = nil
file_mail_msg_proto_goTypes = nil
file_mail_msg_proto_depIdxs = nil
}

View File

@ -1,21 +0,0 @@
syntax = "proto3";
option go_package = ".;pb";
message MailAttachment { //
uint32 Itemid = 1; // iD
uint32 ItemCount = 2; //
}
message MailData {
string Title = 1; //
string Contex = 2; //
uint64 CreateTime = 3; //
uint64 DueTime = 4; //
bool Check = 5; //
repeated MailAttachment Items = 6; //
}
message DB_UserMailData {
string UserId = 1; //tags:{bson:"_id"}Id
repeated MailData mails = 2; //
}

23
pb/proto/mail_db.proto Normal file
View File

@ -0,0 +1,23 @@
syntax = "proto3";
option go_package = ".;pb";
// message Cache_mailData {
// string UserID = 1;
// repeated DB_MailData MailData = 2;
// }
message MailAttachment { //
uint32 ItemId = 1; // iD
uint32 ItemCount = 2; //
}
message DB_MailData {
string ObjId = 1; // tags:{bson:"_id"}
string UserId = 2;
string Title = 3; //
string Contex = 4; //
uint64 CreateTime = 5; //
uint64 DueTime = 6; //
bool Check = 7; //
repeated MailAttachment Items = 8; //
}

39
pb/proto/mail_msg.proto Normal file
View File

@ -0,0 +1,39 @@
syntax = "proto3";
option go_package = ".;pb";
import "mail_db.proto";
message QueryUserMailReq {
}
//
message QueryUserMailResp {
repeated DB_MailData Mails = 1;
}
//
message ReadUserMailReq {
string ObjID = 1;
}
message ReadUserMailResp {
DB_MailData Mail = 1;
}
//
message GetUserMailAttachmentReq {
string ObjID = 1;
}
message GetUserMailAttachmentResp {
DB_MailData Mail = 1;
}
//
message DelUserMailReq {
string ObjID = 1;
}
message DelUserMailResp {
repeated DB_MailData Mail = 1;
}

View File

@ -89,7 +89,7 @@ type DB_UserData struct {
unknownFields protoimpl.UnknownFields
UserId string `bson:"_id" json:"UserId,omitempty" protobuf:"bytes,1,opt,name=UserId,proto3"` //tags:{bson:"_id"}动态Id
Account string `protobuf:"bytes,2,opt,name=account,proto3" json:"account,omitempty"`
Account string `protobuf:"bytes,2,opt,name=Account,proto3" json:"Account,omitempty"`
NiceName string `protobuf:"bytes,3,opt,name=NiceName,proto3" json:"NiceName,omitempty"`
Email string `protobuf:"bytes,4,opt,name=Email,proto3" json:"Email,omitempty"`
Password string `protobuf:"bytes,5,opt,name=Password,proto3" json:"Password,omitempty"`
@ -177,8 +177,8 @@ var file_user_db_proto_rawDesc = []byte{
0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x22, 0x8d, 0x01, 0x0a, 0x0b, 0x44, 0x42, 0x5f, 0x55, 0x73,
0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x18,
0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x4e, 0x69, 0x63, 0x65,
0x0a, 0x07, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
0x07, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x4e, 0x69, 0x63, 0x65,
0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4e, 0x69, 0x63, 0x65,
0x4e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x04, 0x20,
0x01, 0x28, 0x09, 0x52, 0x05, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x61,

View File

@ -31,4 +31,5 @@ buildProto('./pb/proto','./pb','user_db')
buildProto('./pb/proto','./pb','user_msg')
buildProto('./pb/proto','./pb','pack_db')
buildProto('./pb/proto','./pb','pack_msg')
buildProto('./pb/proto','./pb','mail')
buildProto('./pb/proto','./pb','mail_db')
buildProto('./pb/proto','./pb','mail_msg')

52
sys/cache/mail.go vendored
View File

@ -1,12 +1,8 @@
package cache
import (
"fmt"
"go_dreamfactory/pb"
"go_dreamfactory/sys/db"
"github.com/liwei1dao/lego/sys/mgo"
"github.com/liwei1dao/lego/sys/redis"
)
const ( //Redis
@ -14,22 +10,42 @@ const ( //Redis
)
type IMail interface {
QueryUserMail(uId string) (mail *pb.DB_UserMailData, err error)
QueryUserMail(uId string) (mail []*pb.DB_MailData, err error)
InsertUserMail(uId string) (mail []*pb.DB_MailData, err error)
ReadOneMail(uId string, ObjId string) (mail *pb.DB_MailData, err error)
}
// 查询玩家邮件数据
func (this *Cache) QueryUserMail(uId string) (mail *pb.DB_UserMailData, err error) {
mail = &pb.DB_UserMailData{
UserId: uId,
}
if err = this.redis.Get(fmt.Sprintf(Redis_MailCache, uId), mail); err == nil {
return
} else if err == redis.RedisNil {
if mail, err = db.Defsys.QueryUserMail(uId); err == nil {
this.redis.Set(fmt.Sprintf(Redis_MailCache, uId), mail, -1)
} else if err == mgo.MongodbNil {
err = nil
}
}
func (this *Cache) QueryUserMail(uId string) (mail []*pb.DB_MailData, err error) {
// var result []interface{}
// if result, err = this.redis.HGetAll(fmt.Sprintf(Redis_MailCache, uId), reflect.TypeOf(&pb.DB_MailData{})); err != nil {
// return
// } else {
// mail = make([]*pb.DB_MailData, len(result))
// for i, v := range result {
// mail[i] = v.(*pb.DB_MailData)
// }
// }
// 邮件暂时不写redis
mail, _ = db.Defsys.QueryUserMail(uId)
// } else if err == redis.RedisNil {
// if mail, err = db.Defsys.QueryUserMail(uId); err == nil {
// this.redis.Set(fmt.Sprintf(Redis_MailCache, uId), mail, -1)
// } else if err == mgo.MongodbNil {
// err = nil
// }
// }
return
}
// 创建新的邮件
func (this *Cache) ReadOneMail(uId string, ObjId string) (mail *pb.DB_MailData, err error) {
return
}
func (this *Cache) InsertUserMail(uId string) (mail []*pb.DB_MailData, err error) {
return
}

View File

@ -1,22 +1,38 @@
package db
import (
"context"
"go_dreamfactory/pb"
"github.com/liwei1dao/lego/core"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive"
)
const ( //Redis
const (
DB_MailTable core.SqlTable = "mail"
)
type IMail interface {
QueryUserMail(uId string) (mail *pb.DB_UserMailData, err error)
QueryUserMail(uId string) (mail []*pb.DB_MailData, err error)
InsertUserMail(mail *pb.DB_MailData) (err error)
}
func (this *DB) QueryUserMail(uId string) (mail *pb.DB_UserMailData, err error) {
mail = &pb.DB_UserMailData{}
err = this.mgo.FindOne(DB_MailTable, bson.M{"_id": uId}).Decode(mail)
func (this *DB) QueryUserMail(uId string) (mail []*pb.DB_MailData, err error) {
if _data, err := this.mgo.Find(DB_MailTable, bson.M{"userid": uId}); err == nil {
for _data.Next(context.TODO()) {
temp := &pb.DB_MailData{}
if err = _data.Decode(temp); err == nil {
mail = append(mail, temp)
}
}
}
return
}
func (this *DB) InsertUserMail(mail *pb.DB_MailData) (err error) {
mail.ObjId = primitive.NewObjectID().Hex()
_, err = this.mgo.InsertOne(DB_MailTable, mail)
return err
}